ASCII Table: Complete Character Reference
A comprehensive ASCII table reference with decimal, hexadecimal, octal, and binary values for all 128 ASCII characters.
ASCII Table: Complete Character Reference
The American Standard Code for Information Interchange (ASCII) is a character encoding standard for electronic communication. Developed in 1963, ASCII codes represent text in computers, telecommunications equipment, and other devices. It forms the foundation of almost all modern character encoding schemes, including UTF-8.
Original ASCII uses 7 bits for each character, allowing for a total of 128 unique characters ($2^7$). These 128 characters are divided into two main categories: Control Characters and Printable Characters.
1. Control Characters (0-31 and 127)
The first 32 characters in the ASCII table (decimal values 0 through 31), along with the final character (127), are known as control characters. Originally designed to control hardware devices like teletypes and printers, most of these characters are non-printing.
Some of the most important control characters include:
- Null (0 / 0x00): Often used in programming languages like C to indicate the end of a string.
- Line Feed (10 / 0x0A): Moves the cursor to the next line. Often abbreviated as LF or
\n. - Carriage Return (13 / 0x0D): Returns the cursor to the beginning of the line. Often abbreviated as CR or
\r. - Escape (27 / 0x1B): Used to initiate escape sequences for terminal control.
- Delete (127 / 0x7F): Originally used to punch out all 7 holes on paper tape to erase a character.
2. Printable Characters (32-126)
Characters from 32 to 126 are printable characters, representing spaces, punctuation, numbers, and the English alphabet.
The Space Character
- Space (32 / 0x20): The first printable character is the standard space.
Punctuation and Symbols
ASCII includes a variety of punctuation marks and symbols, scattered throughout the printable range.
- Examples:
!(33 / 0x21),@(64 / 0x40),~(126 / 0x7E).
Numbers (48-57)
The digits 0 through 9 are sequentially encoded starting from decimal 48 (hexadecimal 30).
0is 48 (0x30)9is 57 (0x39)
Tip for developers: You can quickly find the integer value of an ASCII digit by subtracting 48 from its ASCII decimal value.
Uppercase Letters (65-90)
The uppercase English alphabet starts at decimal 65 (hexadecimal 41).
Ais 65 (0x41)Zis 90 (0x5A)
Lowercase Letters (97-122)
The lowercase English alphabet starts at decimal 97 (hexadecimal 61).
ais 97 (0x61)zis 122 (0x7A)
Tip for developers: Notice that the difference between an uppercase letter and its lowercase equivalent is always 32 (e.g., ‘A’ is 65, ‘a’ is 97). In binary, this is equivalent to flipping the 6th bit, making case conversion a very fast operation at the machine level.
Extended ASCII
Standard ASCII only uses 7 bits, leaving the 8th bit of a standard byte unused. This led to various “Extended ASCII” sets that utilized all 8 bits to provide 256 characters ($2^8$). The first 128 characters remain identical to standard ASCII, while the characters from 128-255 were used for accented letters, graphic symbols, and other special characters.
However, because different systems and regions used different mappings for these higher 128 characters (like ISO-8859-1 for Western European languages), Extended ASCII lacked the universal standard of 7-bit ASCII, eventually leading to the widespread adoption of Unicode.
When converting strings to hexadecimal, understanding the underlying ASCII values is essential, as the hex output is a direct reflection of these standardized numerical codes.