In this article
What Is ASCII?
ASCII (American Standard Code for Information Interchange) is a character encoding standard published in 1963 that assigns numeric values to 128 characters. It includes 33 control characters (codes 0-31 and 127), a space character (code 32), and 94 printable characters including letters, digits, and punctuation.
ASCII became the foundation of modern text encoding. Unicode's first 128 code points are identical to ASCII, ensuring backward compatibility. Every programmer encounters ASCII values when working with character manipulation, binary protocols, or data validation.
How ASCII Encoding Works
ASCII uses 7 bits to represent each character, allowing for exactly 128 unique values (0 to 127). The encoding is divided into control characters, printable characters, and organized ranges for digits, uppercase letters, and lowercase letters.
- Control characters (0-31, 127) — non-printable codes like NULL (0), TAB (9), LF (10), CR (13), and ESC (27) that control text processing
- Printable range (32-126) — space (32), digits 0-9 (48-57), uppercase A-Z (65-90), lowercase a-z (97-122), and punctuation symbols
- Design patterns — uppercase and lowercase letters differ by exactly 32 (bit 5), making case conversion a single bit operation
Try it free — no signup required
Explore the ASCII Table →When To Use an ASCII Reference
Having the ASCII table at hand is essential for many common programming and debugging tasks.
- Character validation — check if a byte falls within the printable ASCII range (32-126) when sanitizing input or building parsers
- Protocol debugging — many network protocols (HTTP, SMTP, FTP) use ASCII text for headers and commands, so knowing character codes helps analyze raw traffic
- Bit manipulation — the ASCII table reveals patterns like digit-to-value conversion (subtract 48), case toggling (XOR with 32), and control character identification
Frequently Asked Questions
What is the difference between ASCII and Unicode?
ASCII defines 128 characters using 7 bits. Unicode is a superset that defines over 149,000 characters across all writing systems. The first 128 Unicode code points (U+0000 to U+007F) are identical to ASCII, so any valid ASCII text is also valid UTF-8 Unicode.
What are ASCII control characters used for?
Control characters (0-31 and 127) were originally designed to control teletype machines and printers. Today, the most commonly used are NULL (0) for string termination in C, TAB (9) for indentation, LF (10) for Unix newlines, CR (13) for Windows newlines (CR+LF), and ESC (27) for terminal escape sequences.
Why do uppercase and lowercase letters differ by 32 in ASCII?
This is by design. Uppercase A is 65 (0100 0001) and lowercase a is 97 (0110 0001) — they differ only in bit 5. This makes case conversion extremely efficient: toggle bit 5 to switch case, set bit 5 to force lowercase, clear bit 5 to force uppercase. This pattern was intentionally built into the ASCII standard.