The complete ASCII table
ASCII (American Standard Code for Information Interchange) assigns numbers 0–127 to letters, digits, punctuation and control codes. Published in 1963, it is still the foundation of text encoding: the first 128 code points of Unicode and UTF-8 are identical to ASCII. This ASCII table lists every character with its decimal, hexadecimal, octal and binary value, its HTML numeric reference and a description.
How the table is organised
- 0–31 and 127 — control characters: non-printing codes from the teleprinter era. The ones you still meet daily are 9 (TAB,
\t), 10 (LF,\n), 13 (CR,\r), 27 (ESC, used in terminal colour codes) and 0 (NUL, the C string terminator). - 32 — space.
- 48–57 — digits 0–9 (hex 30–39), so a digit's value is its code minus 48.
- 65–90 — uppercase A–Z and 97–122 — lowercase a–z. Upper- and lowercase differ by exactly 32 (one bit, 0x20), which is why case conversion is a single bit flip.
- Punctuation and symbols fill the gaps.
Extended ASCII
ASCII is a 7-bit code; values 128–255 are not ASCII at all. Many "extended ASCII" code pages filled them differently. With the option enabled, the table shows ISO-8859-1 (Latin-1), which matches the first 256 Unicode code points. Windows-1252 is almost identical but places characters such as €, “ ” and — in the 128–159 range, where Latin-1 has control codes — a frequent source of garbled text.
Line endings
Unix, Linux and macOS end lines with LF (10); Windows uses CR LF (13 10). Mixed line endings are behind many "invisible" diff changes and script errors like bad interpreter: /bin/bash^M, where ^M is the carriage return.
Convert text to codes with text to ASCII and back with ASCII to text, or look up any Unicode character with the Unicode character inspector.
ASCII in programming
Many everyday tricks rely on the table's layout: checking whether a character is a digit by comparing it with 48 and 57, converting a letter to lowercase by adding 32, or sorting strings "ASCIIbetically", where uppercase letters come before lowercase ones and "Z" sorts before "a". Knowing the hexadecimal values also helps when reading hex dumps, URL encodings such as %20 for space, and escape sequences like \x1B for ESC.
Control keys and the ASCII table
Holding Ctrl on a terminal keyboard clears the two high bits of a letter's code, so Ctrl plus a key sends that character's code minus 64. This explains several shortcuts that still work in every shell:
| Keys | Code | Name | Typical effect |
|---|---|---|---|
| Ctrl+C | 3 | ETX | Interrupt the running program |
| Ctrl+D | 4 | EOT | End of input on Unix terminals |
| Ctrl+H | 8 | BS | Backspace |
| Ctrl+I | 9 | HT | Tab |
| Ctrl+M | 13 | CR | Enter, and the ^M seen in Windows files |
| Ctrl+Z | 26 | SUB | Suspend a job on Unix; end of file in the Windows console |
| Ctrl+[ | 27 | ESC | Escape, handy in Vim |
The caret notation in the last column is the same idea written down: ^M means “the character you get with Ctrl+M”.
Privacy
The tool runs entirely in your browser. Nothing you type or paste is sent to our servers.
Print an ASCII table in Python
An ASCII table in Python is a loop over the code numbers: chr(code) gives the character, and format codes print the same number in hex (02X), octal (03o) and binary (08b). ord() is the reverse lookup. The loop below covers 32 to 126, because codes 0–31 and 127 are control characters with nothing visible to print. Keep in mind that chr() and ord() cover all of Unicode, not only ASCII: chr(233) returns é without complaint, so use str.isascii() when the distinction matters.
print("Dec Hex Oct Binary Char")
for code in range(32, 127):
char = "SP" if code == 32 else chr(code)
print(f"{code:3d} {code:02X} {code:03o} {code:08b} {char}")
# Lookups in both directions
print(ord("A"), chr(97), hex(ord("~"))) # 65 a 0x7e
# chr() is not limited to ASCII, so test the range yourself
print(chr(233), "é".isascii(), "e".isascii()) # é False True
The decimal, hex and octal columns it prints match the table on this page, which also names the control characters.