ASCII stands for American Standard Code for Information Interchange. The standard was first published in 1963 by the American Standards Association (now ANSI) and updated to its current form in 1968. Its job was straightforward: give every character on a typewriter keyboard a unique number so that different computers and teleprinters could exchange text without confusion. Before ASCII, manufacturers used their own incompatible codes, and two machines from different vendors often could not read each other's output.
The solution was a 7-bit code, which gives 128 possible values (0 through 127). That was enough for the English alphabet in upper and lower case, the ten digits, common punctuation, and a set of control characters used to manage the communication channel itself. The standard was quickly adopted across the American computing industry, and its influence spread globally.
The 128 ASCII Characters
The 128 ASCII characters split into two groups: control characters and printable characters.
Control characters (codes 0 to 31, plus code 127). These are not letters or symbols. They are instructions. Code 7 is BEL, which rang a physical bell on teleprinters. Code 8 is BS (backspace). Code 10 is LF (line feed, the Unix newline). Code 13 is CR (carriage return, which moves the print head back to the start of the line). Code 27 is ESC, still used today to signal command sequences in terminal emulators. Most control characters were designed for the physical mechanics of teletype machines, which is why some of them feel like relics when you encounter them in a Unix config file.
Printable characters (codes 32 to 126). Code 32 is the space. Codes 33 to 47 cover punctuation and symbols like !, ", #, $, %. The digits 0 through 9 occupy codes 48 to 57. Uppercase letters A through Z run from code 65 to 90. Lowercase letters a through z run from code 97 to 122. Codes 91 to 96 and 123 to 126 fill in the remaining symbols: [, \, ], ^, _, `, {, |, }, ~.
The 32-unit gap between uppercase and lowercase letters (A is 65, a is 97) is not an accident. It means you can toggle case on any letter by flipping a single bit, specifically bit 5 (the one with value 32). That made case conversion trivial in early software.
How ASCII Maps to Binary
Every ASCII code is a number from 0 to 127. That fits in 7 bits. In practice, computers store data in 8-bit bytes, so the eighth bit (the most significant) is set to 0 for ASCII characters. Here are a handful of common characters with their decimal code and 8-bit binary representation:
| Character | ASCII code (decimal) | Binary (8-bit) |
|---|---|---|
| A | 65 | 01000001 |
| B | 66 | 01000010 |
| Z | 90 | 01011010 |
| a | 97 | 01100001 |
| z | 122 | 01111010 |
| 0 | 48 | 00110000 |
| 9 | 57 | 00111001 |
| space | 32 | 00100000 |
| ! | 33 | 00100001 |
Notice that uppercase A is 01000001 and lowercase a is 01100001. The only difference is bit 5. Flip that bit and you flip the case. Compilers and string libraries have been exploiting that shortcut since the 1960s.
Worked Example: Encoding "Yes" to Binary
The word "Yes" is three characters. Each maps to an ASCII code, which then maps to an 8-bit binary byte:
| Character | ASCII code | Binary |
|---|---|---|
| Y | 89 | 01011001 |
| e | 101 | 01100101 |
| s | 115 | 01110011 |
Concatenated, the binary encoding of "Yes" is: 01011001 01100101 01110011. A network packet carrying that string contains exactly those 24 bits (3 bytes). Every text string your computer processes goes through this mapping, usually transparently and automatically.
Extended ASCII: Codes 128 to 255
The original 128-character set had no room for accented letters, Cyrillic, Greek, or the box-drawing characters that early PCs used to draw menus. Various organisations solved this by using the eighth bit, which was set to 0 in standard ASCII, to add 128 more characters in the range 128 to 255.
The problem: there was no agreement on what those 128 extra codes should mean. IBM defined code page 437 for the original IBM PC, which included line-drawing characters and some Western European letters. Microsoft later used Windows-1252 (also called CP-1252) for Windows in Western European markets. ISO standardised ISO 8859-1 (Latin-1) for a similar purpose. All three encode characters like e-acute (e with accent) but at different code points, and they disagree on large stretches of the range.
"Extended ASCII" is not a single standard. It is a category name for all these competing 8-bit schemes. If you open a file encoded in Windows-1252 with a program expecting ISO 8859-1, the characters in the 128 to 159 range will look garbled. This fragmentation was the direct motivation for Unicode.
Unicode and UTF-8: ASCII Is Still Inside
Unicode, published as a standard beginning in 1991, assigns a unique code point to every character in every writing system, including emoji. The current version (Unicode 15.1, published September 2023) covers over 149,000 characters across 161 scripts. The ASCII characters are code points U+0000 through U+007F, with identical values to the original ASCII codes.
UTF-8 is the most common way to encode Unicode as bytes. It encodes the first 128 code points (the ASCII range) as single bytes, identical to how ASCII encodes them. A plain ASCII text file is a valid UTF-8 file with no conversion required. Code points above 127 use two to four bytes, with the leading bits indicating how many bytes the character needs. This backward compatibility with ASCII was a deliberate design choice by Ken Thompson and Rob Pike, who specified UTF-8 in 1992.
The practical result: any system that handles UTF-8 handles ASCII automatically. English-language source code, HTTP headers, JSON syntax, and email headers are ASCII-only in practice, even when the files that contain them are formally UTF-8.
ASCII in Practice Today
ASCII is not a museum piece. It is in active use across the infrastructure of the internet.
HTTP headers. The header lines in an HTTP request and response must be ASCII. The status line "HTTP/1.1 200 OK" is ASCII. Header field names like Content-Type and Accept-Encoding are ASCII. The body of the response can be anything, but the framing is ASCII. This is specified in RFC 7230, published by the IETF in 2014.
JSON. JSON syntax (braces, brackets, colons, commas, quote marks) is pure ASCII. String values inside JSON can contain Unicode escape sequences, but the structural characters that define JSON as JSON are all ASCII characters with codes below 128. The JSON specification (ECMA-404, 2013) is explicit about this.
Source code. The keywords, operators, and punctuation of most programming languages (C, Python, JavaScript, Go, Rust) are ASCII. Variable names in those languages can often include non-ASCII characters in newer versions, but the language syntax itself is defined in terms of ASCII characters.
File permissions and configuration files. Unix permission bits, cron job syntax, SSH configuration, Apache and Nginx config files: all plain ASCII text. The simplicity that made ASCII useful in 1963 is the same thing that makes these files easy to transmit, version-control, and read on any system without encoding negotiation.
For a hands-on walkthrough of converting text to binary using ASCII codes, see how to convert text to binary. If you want the broader picture of how binary works before getting into character encoding, start with how binary code works.
Things to Know
- ASCII covers only codes 0 to 127, which fits in 7 bits; the 8th bit in a byte is padding, not data, for plain ASCII text.
- The gap between uppercase and lowercase (32) is exactly one bit, bit 5, which is why toggling case is a single-bit flip in hardware.
- "Extended ASCII" is not one standard. Code page 437, Windows-1252, and Latin-1 all use codes 128 to 255 differently, which is why old text files sometimes show garbled characters.
- UTF-8 was built to be backward-compatible with ASCII on purpose: any plain ASCII file is already valid UTF-8, byte for byte.
FAQ
What is the ASCII code for a space character?
A space has ASCII code 32, which is 00100000 in binary. It is the first printable character in the ASCII table, sitting just below the exclamation mark at code 33. That ordering reflects the original teletype convention: space was treated as a "blank" rather than a control character, but it comes before any visible glyph.
Is ASCII still used today, or has Unicode completely replaced it?
ASCII is still in active use. The first 128 code points of Unicode are identical to ASCII, and UTF-8 encodes them with the same single byte. HTTP headers, JSON keys, email headers, source code, and most configuration files are pure ASCII. Unicode extends that foundation for every other writing system, but it did not displace ASCII; it absorbed it.
Why does uppercase A have a lower ASCII code than lowercase a?
The ASCII designers placed uppercase letters (65 to 90) before lowercase letters (97 to 122) so that alphabetic sorting on early computers would put capitals first, matching the convention of printed indexes and directories at the time. The 32-unit gap also has a useful side effect: flipping bit 5 toggles case, which made case-insensitive comparisons cheap to implement in hardware and early software.
What is extended ASCII, and is it a single standard?
Extended ASCII refers to any scheme that uses codes 128 to 255 for additional characters beyond the original 128. There is no single extended ASCII standard. IBM defined code page 437 for the original PC. Microsoft used Windows-1252 for Western European text on Windows. ISO 8859-1 (Latin-1) was a separate standard covering similar characters. They overlap but are not identical, which is exactly the fragmentation problem Unicode was designed to solve.
