ASCII (American Standard Code for Information Interchange) is a 7-bit character encoding standard that maps 128 characters — including English letters, digits, punctuation, and control codes — to numeric values 0 through 127. Published in 1963, ASCII is the foundation that virtually all modern character encodings build upon.
The character set
ASCII defines 128 characters split into two groups:
- Control characters (0-31, 127): Non-printable characters like null (
\0), tab (\t), newline (\n), carriage return (\r), escape (\x1B), and delete. These originally controlled teletype machines. - Printable characters (32-126): Space, digits 0-9, uppercase A-Z, lowercase a-z, and punctuation/symbols.
Key code points developers memorize:
48-57: 0-9
65-90: A-Z
97-122: a-z
32: space
10: newline (LF)
13: carriage return (CR)
The difference between uppercase and lowercase letters is always 32 — a deliberate design choice that makes case conversion a single bit flip.
Why ASCII still matters
ASCII is a subset of UTF-8. Every ASCII character has the same byte value in UTF-8, which is why ASCII compatibility was crucial for UTF-8’s adoption. When a specification says “ASCII-safe,” it means only bytes 0-127 are used, guaranteeing compatibility with any encoding.
ASCII is the baseline for:
- Protocol headers: HTTP, SMTP, and FTP headers are ASCII
- Source code: Most programming languages use ASCII for syntax (keywords, operators, identifiers)
- Hostname rules: Domain names originally required ASCII (before internationalized domain names)
- File paths: Many file systems work best with ASCII filenames
Extended ASCII
“Extended ASCII” refers to various 8-bit encodings (like ISO 8859-1, Windows-1252) that use values 128-255 for additional characters. These are not standardized — different encodings map the upper 128 values to different characters. This incompatibility is exactly what Unicode and UTF-8 were designed to solve.
Practical uses
Developers frequently need to look up ASCII values for debugging character encoding issues, writing binary protocols, or understanding escape sequences. The classic man ascii command on Unix systems remains useful.
Look up character codes in the ASCII Table, convert between representations with ASCII to Hex, or create text art with Image to ASCII.