Computing

What Is ASCII? Text, Hex and Binary Explained

ASCII is a 7-bit code that maps 128 characters to the numbers 0–127. Trace the letter A through decimal, hex and binary, and see where UTF-8 differs.

ASCII (American Standard Code for Information Interchange) is a character code that assigns the numbers 0 to 127 to English letters, digits, punctuation and 33 control codes. Because 127 fits in 7 bits, every ASCII character fits in one byte. The letter A is 65, which is 0x41 in hex and 01000001 in binary.

Trace one letter: A

FormValueHow to read it
CharacterAwhat you see
Decimal65its ASCII code
Hexadecimal414 × 16 + 1 = 65
Binary0100 000164 + 1 = 65; each hex digit is one 4-bit group
UTF-8 bytes41identical: UTF-8 keeps ASCII as is

Type any characters below. Everything up to code 127 stays a single byte; anything beyond it needs more.

Try itType characters to trace them through decimal, hex and UTF-8 binary.
CharDecimalHex (code point)UTF-8 bytes in binaryASCII?
A654101000001yes
é233E911000011 10101001no (2 UTF-8 bytes)
€836420AC11100010 10000010 10101100no (3 UTF-8 bytes)

2 character(s) fall outside ASCII (0–127), so UTF-8 stores them in 2–4 bytes.

How the 128 codes are laid out

ASCII was designed so the bit patterns themselves carry meaning:

  • 0–31 and 127: control codes. Originally commands for teleprinters. The survivors are tab (9), line feed (10) and carriage return (13). Unix-style files end lines with LF; Windows uses CR LF.
  • 32: space.
  • 48–57: digits. “0” is 48 (0011 0000). Subtract 48 to get the digit’s value, or keep just the low four bits.
  • 65–90 and 97–122: letters. Lowercase is uppercase plus 32. In binary that is a single bit: A is 0100 0001, a is 0110 0001. Flipping bit 5 changes case.
  • The rest: punctuation and symbols such as !, @, [ and ~.

The ASCII table lists all 128 codes with their decimal, hex, octal and binary values and lets you search by any of them.

Why 7 bits, stored in 8

ASCII was standardized in the 1960s as a 7-bit code (RFC 20 describes its use for network interchange in 1969). Computers settled on 8-bit bytes, so ASCII text stores each character in a byte with the top bit set to 0. That spare top bit is what “extended ASCII” code pages later used for 128 more characters, and why those extensions disagree with each other: byte 233 is é in ISO 8859-1 and Windows-1252 but a different character in other code pages. Strictly speaking, ASCII has no characters above 127.

ASCII vs Unicode vs UTF-8

Unicode assigns a number (a code point) to well over a hundred thousand characters from every script, plus symbols and emoji. Its first 128 code points are exactly ASCII.

UTF-8 is the most common way to store those code points as bytes. It is variable-length:

CharacterCode pointUTF-8 bytes (hex)Bytes
AU+0041411
éU+00E9C3 A92
€U+20ACE2 82 AC3
😀U+1F600F0 9F 98 804

So every ASCII file is already valid UTF-8, which is a large part of why UTF-8 won. The reverse is not true: a UTF-8 file with é in it contains bytes above 127 that are not ASCII.

What goes wrong when encodings are mixed

If the two UTF-8 bytes for é (C3 A9) are read as if they were Windows-1252 or ISO 8859-1, each byte becomes its own character and “é” turns into “é”. We reproduced this in Python with b'\xc3\xa9'.decode('latin-1'), which returns 'é'. This garbling is called mojibake, and the fix is always to decode with the encoding the text was written in, not to edit the characters.

Reading ASCII in binary

Binary text such as 01001000 01101001 is a sequence of ASCII codes, one per byte: 72 and 105, “H” and “i”. The guide to reading binary walks through the place values, and the binary translator decodes whole messages and flags bytes that are not valid UTF-8.

Sources

  1. RFC 20: ASCII format for Network Interchange — IETF, 1969
  2. C0 Controls and Basic Latin (U+0000–U+007F) — Unicode Consortium
  3. RFC 3629: UTF-8, a transformation format of ISO 10646 — IETF

How we made this

Computed and checked by tests. Every code and byte sequence was produced with Python's ord() and str.encode('utf-8'); the mis-decoding example was produced with bytes.decode('latin-1'). The interactive trace uses the browser's TextEncoder and is covered by tests.

Performed by Claude, an AI assistant working in the BinConvert repository (Python 3.14.3), November 16, 2026.

This article was drafted with AI assistance. Every example, calculation and command output on this page was re-run or checked before release; code points and UTF-8 bytes were regenerated in Python and compared with the tables. Review: automated test suite and source check, November 16, 2026.

Spotted an error? Tell us and we will correct it.

Copied to clipboard!