ASCII (American Standard Code for Information Interchange) is the bedrock of digital text. Published in 1963 and finalized as ANSI X3.4 in 1968, this 7-bit encoding standard defines 128 characters that form the foundation of virtually every modern text encoding system. Whether you're a seasoned developer debugging character encoding issues or a student learning computer science fundamentals, this guide provides every ASCII value you'll ever need in one comprehensive reference.
ASCII Control Characters (Decimal 0–31)
The first 32 positions in the ASCII table (0–31) are reserved for control characters — non-printable codes originally designed to control teletype machines and early computer terminals. While most are invisible, they remain critically important in modern computing for text formatting, network protocols, and terminal control.
| Dec | Hex | Char | Name | Modern Use |
|---|---|---|---|---|
| 0 | 00 | NUL | Null | String terminator in C |
| 1 | 01 | SOH | Start of Heading | Unused today |
| 2 | 02 | STX | Start of Text | Unused today |
| 3 | 03 | ETX | End of Text | End-of-transmission in serial |
| 4 | 04 | EOT | End of Transmission | Unix EOF marker (Ctrl+D) |
| 5 | 05 | ENQ | Enquiry | Unused today |
| 6 | 06 | ACK | Acknowledge | Serial protocols |
| 7 | 07 | BEL | Bell | Terminal alert sound |
| 8 | 08 | BS | Backspace | Text editing (Ctrl+H) |
| 9 | 09 | HT | Horizontal Tab | Tab formatting, \t escape |
| 10 | 0A | LF | Line Feed | Unix newline (\n) |
| 11 | 0B | VT | Vertical Tab | Rare formatting |
| 12 | 0C | FF | Form Feed | Page break (\f) |
| 13 | 0D | CR | Carriage Return | Windows newline (\r) |
| 14 | 0E | SO | Shift Out | Unused today |
| 15 | 0F | SI | Shift In | Unused today |
| 16 | 10 | DLE | Data Link Escape | Serial protocols |
| 17 | 11 | DC1 | Device Control 1 | XON flow control (Ctrl+Q) |
| 18 | 12 | DC2 | Device Control 2 | Unused today |
| 19 | 13 | DC3 | Device Control 3 | XOFF flow control (Ctrl+S) |
| 20 | 14 | DC4 | Device Control 4 | Unused today |
| 21 | 15 | NAK | Negative Ack | Serial protocols |
| 22 | 16 | SYN | Synchronous Idle | Unused today |
| 23 | 17 | ETB | End Trans. Block | Unused today |
| 24 | 18 | CAN | Cancel | Cancel operation |
| 25 | 19 | EM | End of Medium | Unused today |
| 26 | 1A | SUB | Substitute | Windows EOF marker (Ctrl+Z) |
| 27 | 1B | ESC | Escape | ANSI escape sequences |
| 28 | 1C | FS | File Separator | Data delimiting |
| 29 | 1D | GS | Group Separator | Data delimiting |
| 30 | 1E | RS | Record Separator | Data delimiting |
| 31 | 1F | US | Unit Separator | Data delimiting |
| 127 | 7F | DEL | Delete | Backspace character |
The most commonly used control characters today are LF (10) for Unix line endings, CR+LF (13+10) for Windows line endings, TAB (9) for indentation, NUL (0) as a C string terminator, and ESC (27) for terminal color codes and control sequences.
ASCII Printable Characters (Decimal 32–126)
Characters 32 through 126 are the printable ASCII characters — the visible symbols you type on a keyboard every day. This range includes the space character, punctuation marks, digits, uppercase and lowercase letters, and common symbols.
Punctuation and Symbols (32–47)
| Dec | Hex | Char | Description |
|---|---|---|---|
| 32 | 20 | (space) | Space character |
| 33 | 21 | ! | Exclamation mark |
| 34 | 22 | " | Double quotation mark |
| 35 | 23 | # | Number sign (hash) |
| 36 | 24 | $ | Dollar sign |
| 37 | 25 | % | Percent sign |
| 38 | 26 | & | Ampersand |
| 39 | 27 | ' | Apostrophe (single quote) |
| 40 | 28 | ( | Left parenthesis |
| 41 | 29 | ) | Right parenthesis |
| 42 | 2A | * | Asterisk |
| 43 | 2B | + | Plus sign |
| 44 | 2C | , | Comma |
| 45 | 2D | - | Hyphen-minus |
| 46 | 2E | . | Period (full stop) |
| 47 | 2F | / | Forward slash |
Digits (48–57)
| Dec | Hex | Char |
|---|---|---|
| 48 | 30 | 0 |
| 49 | 31 | 1 |
| 50 | 32 | 2 |
| 51 | 33 | 3 |
| 52 | 34 | 4 |
| 53 | 35 | 5 |
| 54 | 36 | 6 |
| 55 | 37 | 7 |
| 56 | 38 | 8 |
| 57 | 39 | 9 |
Note the useful property: ASCII digit values are sequential, so converting a character digit to its numeric value is simply char - '0' (or char - 48).
Uppercase Letters (65–90)
| Dec | Hex | Char | Dec | Hex | Char | Dec | Hex | Char |
|---|---|---|---|---|---|---|---|---|
| 65 | 41 | A | 74 | 4A | J | 83 | 53 | S |
| 66 | 42 | B | 75 | 4B | K | 84 | 54 | T |
| 67 | 43 | C | 76 | 4C | L | 85 | 55 | U |
| 68 | 44 | D | 77 | 4D | M | 86 | 56 | V |
| 69 | 45 | E | 78 | 4E | N | 87 | 57 | W |
| 70 | 46 | F | 79 | 4F | O | 88 | 58 | X |
| 71 | 47 | G | 80 | 50 | P | 89 | 59 | Y |
| 72 | 48 | H | 81 | 51 | Q | 90 | 5A | Z |
| 73 | 49 | I | 82 | 52 | R |
Key property: the difference between uppercase and lowercase is exactly 32. So 'a' - 'A' = 32. To convert case, XOR with 32 or add/subtract 32.
Lowercase Letters (97–122)
| Dec | Hex | Char | Dec | Hex | Char | Dec | Hex | Char |
|---|---|---|---|---|---|---|---|---|
| 97 | 61 | a | 106 | 6A | j | 115 | 73 | s |
| 98 | 62 | b | 107 | 6B | k | 116 | 74 | t |
| 99 | 63 | c | 108 | 6C | l | 117 | 75 | u |
| 100 | 64 | d | 109 | 6D | m | 118 | 76 | v |
| 101 | 65 | e | 110 | 6E | n | 119 | 77 | w |
| 102 | 66 | f | 111 | 6F | o | 120 | 78 | x |
| 103 | 67 | g | 112 | 70 | p | 121 | 79 | y |
| 104 | 68 | h | 113 | 71 | q | 122 | 7A | z |
| 105 | 69 | i | 114 | 72 | r |
Extended ASCII (Decimal 128–255)
Standard ASCII only uses 7 bits (0–127). The 8th bit was originally reserved as a parity bit for error checking in serial communication. When 8-bit computing became common, the upper 128 values (128–255) were repurposed to add additional characters.
There is no single "extended ASCII" standard. Several competing encodings emerged:
- ISO-8859-1 (Latin-1): Western European standard, includes accented characters like é (233), ñ (241), ü (252), and the § symbol (167). Used as the default in early web standards.
- Windows-1252 (CP1252): Microsoft's extension of Latin-1, adds smart quotes (147–148), em dash (151), and the Euro sign € (128). This is the most common extended ASCII encoding in practice.
- Code Page 437: The original IBM PC character set, includes box-drawing characters (┌─┐), Greek letters, and mathematical symbols. Still visible in terminal emulators today.
For a complete interactive reference with all extended characters, use RiseTop's ASCII Table Tool.
ASCII in Programming: Practical Examples
Understanding ASCII values unlocks powerful text manipulation techniques:
// Case conversion using ASCII math
function toLower(ch) {
return ch >= 65 && ch <= 90 ? ch + 32 : ch;
}
function toUpper(ch) {
return ch >= 97 && ch <= 122 ? ch - 32 : ch;
}
// Check if character is a digit
function isDigit(ch) { return ch >= 48 && ch <= 57; }
// Check if character is alphanumeric
function isAlpha(ch) {
return (ch >= 65 && ch <= 90) || (ch >= 97 && ch <= 122);
}
These operations are O(1) and avoid the overhead of regular expressions or library function calls, making them valuable in performance-critical code paths like parsers and tokenizers.
Key ASCII Properties Every Developer Should Know
- Backward compatibility: UTF-8's first 128 characters are identical to ASCII. Every valid ASCII file is a valid UTF-8 file.
- Case difference is 32:
'a' - 'A' = 32. Toggle case with XOR:ch ^= 32. - Digit ordering: Digits 0-9 are at positions 48-57. Convert digit to number:
ch - 48orch - '0'. - Letter ranges: A-Z = 65-90, a-z = 97-122. No other characters exist between them.
- Space is 32: The space character (decimal 32, hex 20) is the most common character in most English texts.
- DEL is 127: The only control character above the printable range, originally designed to delete the previous character on paper tape.
Frequently Asked Questions
ASCII (American Standard Code for Information Interchange) defines 128 characters numbered 0-127. It includes 32 control characters (0-31 plus 127), 95 printable characters (32-126), and the DEL control character at position 127.
Standard ASCII defines 128 characters (0-127). Extended ASCII refers to various 8-bit encodings that add 128 more characters (128-255) for additional symbols and accented letters. However, there is no single 'extended ASCII' standard — different systems use different extensions like ISO-8859-1, Windows-1252, or Code Page 437.
ASCII control characters are non-printable codes (0-31 and 127) originally designed for teletype and terminal control. They include NUL (null), BEL (bell/beep), BS (backspace), LF (line feed), CR (carriage return), ESC (escape), and DEL (delete). Many are still used in modern computing for text formatting and terminal control.
ASCII remains the foundation of modern text encoding. UTF-8 is backward compatible with ASCII, meaning every ASCII file is a valid UTF-8 file. ASCII characters are used in programming syntax, URLs, email protocols (SMTP), network protocols, and file formats. Understanding ASCII is essential for any developer working with text processing.
In most languages, you can get the ASCII value by casting a character to an integer: Python uses ord('A') returning 65, JavaScript uses 'A'.charCodeAt(0) returning 65, Java uses (int)'A' returning 65, C uses (int)'A' returning 65. The reverse operation — converting an ASCII code to a character — uses chr() in Python and String.fromCharCode() in JavaScript.