128
Original ASCII fits into seven bits.
5 min readLast updated
Photo: Dominic Alves from Brighton, England · CC BY 2.0
The short answer
ASCII assigns 128 code points using seven-bit values, numbered from 0 through 127. Its small repertoire includes English letters, digits, punctuation, and control codes rather than the characters of every writing system.
Why it's true
Seven binary positions provide two to the seventh power possible combinations, which equals 128. That mathematical limit explains the size of the ASCII code space. It does not imply that an ASCII character must occupy only seven physical storage bits in a modern computer.
The familiar division is 95 printable characters and 33 control codes. The printable group includes the ordinary space, even though it leaves no ink-like mark on a screen. Control codes include functions associated with text handling and communication, rather than ordinary visible symbols.
ASCII remains important because Unicode preserves its character assignments in the first 128 code points. UTF-8 also encodes those characters as the same single-byte values. Many basic text files and programming-language fragments can therefore be valid ASCII and valid UTF-8 at the same time.
By the numbers
7 bits
Code width
128
Code points
95
Printable characters
The backstory
ASCII stands for American Standard Code for Information Interchange. It developed in the 1960s as a way for equipment and organizations to exchange text using agreed numerical assignments. Its design reflected the needs of English-language communication and the terminals, teleprinters, and data links of the period.
Uppercase and lowercase Latin letters, decimal digits, and common punctuation fit within the printable portion. Accented letters, most non-Latin scripts, and modern emoji do not. The limited repertoire was useful for standardization, but it could not serve as a complete character set for international communication.
Modern systems commonly store ASCII values in eight-bit bytes, with the highest bit set to zero. Historical communication arrangements could use an additional bit for parity, depending on the system. These storage and transmission details are separate from the defining fact that ASCII itself assigns seven-bit code values.
The wider picture
The phrase "extended ASCII" needs caution. It has been used for multiple incompatible eight-bit encodings that add assignments above 127. Those upper values do not have one universally agreed ASCII meaning. A byte interpreted using one legacy encoding may display a different character when interpreted using another.
Unicode separates the idea of a character code point from the particular bytes used to encode it. UTF-8 is one encoding of Unicode, not a synonym for Unicode itself. Its compatibility with ASCII means that basic ASCII text needs no byte changes when treated as UTF-8, while additional characters use multibyte sequences.
This compatibility does not eliminate every text portability problem. Systems may disagree about line endings, and applications can interpret control characters differently. An ASCII-only file can therefore have compatible character values while still needing adjustments for a particular program. Encoding compatibility is one part of reliable text exchange, not a guarantee of identical behavior.
Worth remembering
- Remember the distinction between a seven-bit character code and the eight-bit bytes commonly used to store it.
- Use a specified encoding, usually UTF-8 for new general-purpose text, when characters outside ASCII are required.
- Do not assume that "extended ASCII" names a single interoperable standard for values from 128 through 255.
In context
ASCII and image palettes share an abstract idea: stored numbers receive agreed meanings. But text encoding identifies characters, while a palette identifies colors. Confusing a code with its visible rendering causes errors in both settings. The same character value can appear in different fonts without becoming a different character.
A closer look
Characters are not their pictures
A font supplies a visual form for a character. ASCII supplies code assignments, not a mandatory typeface or screen appearance. This separation explains why exchanging compatible text values does not guarantee identical page layout. Rendering choices, line handling, and the application remain involved after the bytes have been interpreted as text.
Compatibility has a defined boundary
ASCII-only text fits directly within UTF-8, but arbitrary bytes from an older encoding do not acquire that compatibility merely because some of the file is readable. Values outside the ASCII range need an identified interpretation. Specifying the actual encoding is safer than calling a file plain text and assuming every receiving application will guess correctly.
Related facts
A related history explains why the QWERTY layout comes from 1870s typewriters. The QWERTY keyboard layout dates back to typewriters from the 1870s.
DNS explains how a readable name becomes useful to networked applications. The Internet’s naming system is distributed, not one giant address book.
PNG provides a useful comparison when exact image samples need to be preserved. PNG compression can preserve every original pixel value.
IPv6 adds the separate question of how network destinations are addressed. IPv6 has a vastly larger address space than IPv4.
Key terms
- Character encoding
- Rules that associate text characters with stored or transmitted code values.
- Glyph
- A rendered visual form used to display a character.
People also ask
Is ASCII the same thing as UTF-8?
No. ASCII defines a small set of character assignments, while UTF-8 can represent the much larger Unicode repertoire. UTF-8 deliberately preserves ASCII byte values, so text containing only ASCII characters is also correctly encoded UTF-8 text without conversion.
Why are there 95 printable characters rather than 128?
The remaining 33 positions are control codes rather than ordinary printable characters. They include values historically used for device control, communication, and text layout. The printable count includes space, which occupies a position even though it normally has no visible glyph.
Can ASCII represent an accented name or an emoji?
Not directly when the needed characters fall outside its repertoire. Replacing a character with an unaccented approximation changes the text. An encoding supporting Unicode, such as UTF-8, allows the original characters to be represented instead of forcing those substitutions.
Does ASCII specify the font used to display text?
No. It assigns character codes. Fonts and rendering systems determine their visible shapes.
Is any file with some readable English automatically UTF-8?
No. ASCII portions may be compatible, while other byte sequences require a different interpretation. The complete encoding must be checked.