Free ASCII Table
Complete reference of all 128 ASCII characters with decimal, hex, octal & binary codes.
128 characters shown
About ASCII
ASCII (American Standard Code for Information Interchange) is a 7-bit character encoding standard that defines 128 characters. It was first published in 1963 and is the foundation of most modern character encodings including UTF-8.
Character Ranges
- 0–31 · Control characters (non-printable)
- 32 · Space
- 33–47 · Punctuation & symbols
- 48–57 · Digits 0–9
- 65–90 · Uppercase A–Z
- 97–122 · Lowercase a–z
- 127 · DEL (delete)
What's the difference between ASCII and Unicode?
ASCII defines 128 characters using 7 bits. Unicode is a superset that covers over 149,000 characters from all writing systems. The first 128 Unicode code points are identical to ASCII.
How do I use these codes in programming?
In JavaScript: String.fromCharCode(65) → "A". In Python: chr(65). In C: (char)65. The hex values work with escape sequences: \x41 = "A".
How It Works
- Browse the full table: all 128 ASCII characters appear in a grid sorted by code point (0 through 127). Each cell shows the visible character (or its abbreviation for control codes), the decimal code, and the hex / octal / binary equivalents.
- Filter by category: use the dropdown to narrow to control characters (0–31), printable characters (32–126), letters, digits, or symbols. Useful when you only care about, say, the punctuation block.
- Search: the search box matches by character name ("LF"), abbreviation, or numeric value (decimal or hex). Typing
0x41,65, orAall jump to the same cell. - Click a cell to copy any of its representations to the clipboard. Handy when you need
\x1Bfor an ANSI escape,0x0Afor a Unix newline, or the decimal32for a space.
A Brief History of ASCII
ASCII (American Standard Code for Information Interchange) was proposed by IBM engineer Bob Bemer to the American Standards Association's X3.2 subcommittee in May 1961, with the goal of replacing the dozen incompatible character codes then in use. The first published edition was ASA X3.4-1963; lowercase letters did not arrive until the 1967 revision. The standard has been reaffirmed multiple times since then under the name ANSI X3.4-1986, and it forms the base of every modern character encoding through its international twin, ISO/IEC 646 (and the European ECMA-6).
For network use, ASCII was codified by RFC 20, "ASCII format for Network Interchange," published on 16 October 1969 and authored by Vint Cerf at UCLA. The RFC's recommendation ("7-bit ASCII embedded in an 8-bit byte whose high-order bit is always 0") is still the way every modern programming language and protocol thinks about plain text. The US Federal Government, by executive order from President Lyndon B. Johnson in 1968, mandated ASCII support on all federal computers from 1 July 1969 onward, which guaranteed industry-wide adoption.
Why Seven Bits?
The X3.2 committee was caught between two unattractive options. A 6-bit code (used by older telegraph alphabets like ITA2) was unreliable: a single bit-flip on a noisy line could mis-decode every following character if it happened to land on a shift bit. An 8-bit code seemed wasteful in an era of expensive memory and slow modems. The compromise was 7 bits = 128 code points, leaving the 8th bit free for parity. Setting the parity bit so that every byte had an even (or odd) total number of 1-bits caught 100% of single-bit transmission errors, exactly the problem that 1960s acoustic couplers and serial cables produced.
As error rates dropped and modems got faster, the 8th bit was repurposed. Various national "extended ASCII" code pages (Latin-1, Windows-1252, Mac Roman, KOI8-R, …) used codes 128–255 for accented letters and box-drawing characters, but those mappings were mutually incompatible and were eventually displaced by Unicode and UTF-8.
The Layout: 128 Code Points
7 bits = 27 = 128 distinct codes, organised as 33 control characters (0–31 plus DEL at 127) and 95 printable characters (32–126):
| Range | Hex | Contents |
|---|---|---|
| 0–31 | 00–1F | Control characters (NUL, BEL, BS, HT, LF, CR, ESC, FS-US, …) |
| 32 | 20 | SPACE, printable but invisible |
| 33–47 | 21–2F | Punctuation: ! " # $ % & ' ( ) * + , - . / |
| 48–57 | 30–39 | Digits 0–9 |
| 58–64 | 3A–40 | More punctuation: : ; < = > ? @ |
| 65–90 | 41–5A | Uppercase A–Z |
| 91–96 | 5B–60 | Brackets and accents: [ \ ] ^ _ ` |
| 97–122 | 61–7A | Lowercase a–z |
| 123–126 | 7B–7E | Curly braces and tilde: { | } ~ |
| 127 | 7F | DEL, "rub out" on punched paper tape (binary 1111111) |
Control Characters That Still Matter
Most of the 33 control characters originated as teletype and paper-tape commands and are now historical curiosities. A handful are still load-bearing in everyday computing:
- NUL (0x00): terminates strings in C and any C-derived language. Pasting an embedded null into a file path is a classic way to crash old code.
- BEL (0x07,
\a): the terminal beep. Still triggered byprintf '\a'. - BS (0x08,
\b): backspace. Used by progress-bar libraries to overwrite the previous line. - HT (0x09,
\t): horizontal tab. Defines the tab character used in TSV files and the Python interpreter's eternal indentation debate. - LF (0x0A,
\n): line feed. The Unix newline. - CR (0x0D,
\r): carriage return. Half of the Windows newline; used alone for "return to start of line" in progress bars. - ESC (0x1B,
\e/\x1B): the escape character. Bemer's original invention, now the prefix for every ANSI terminal escape sequence (colours, cursor movement, clear screen). - FS / GS / RS / US (0x1C–0x1F): File / Group / Record / Unit separators. Designed for record-oriented tape storage in the 1960s and largely forgotten, until RFC 7464 "JSON Text Sequences" brought RS back as the prefix delimiter for streaming JSON records (
application/json-seq). GS still appears in some retail barcode protocols. - DEL (0x7F): "rub out." The Teletype Model 33's RUB OUT key sent code 127 because in binary it is
1111111: all seven bits set. To delete a character on paper tape, the operator backed the tape up and pressed RUB OUT, punching through every existing hole. The receiver was supposed to ignore any byte that was all-1s.
The Line-Ending Wars
Three platforms picked three different conventions, and software has been paying for it ever since. The mechanical origin is the typewriter and teletype, where two separate actions were needed: carriage return moved the print head back to column 1, and line feed advanced the paper by one line. Different systems made different decisions about whether to encode this as one byte or two:
| OS | Newline | Bytes | Escape |
|---|---|---|---|
| Unix / Linux / modern macOS | LF | 0x0A | \n |
| Classic Mac OS (pre-OS X) | CR | 0x0D | \r |
| Windows / DOS | CRLF | 0x0D 0x0A | \r\n |
Internet protocols mostly mandate CRLF: HTTP, SMTP, FTP, MIME, and the standard Internet Message Format all specify it. RFC 5322 is unambiguous: "CR and LF MUST only occur together as CRLF; they MUST NOT appear independently" in the message body. Inside source code, however, the convention varies by team, which is why git ships core.autocrlf: with true on Windows, git checks files out as CRLF in the working tree but stores them as LF in the repo, so the same source file produces the same blob hash on every platform. A .gitattributes entry like * text=auto is the project-level alternative.
ANSI Escape Sequences for Terminal Colour
The escape character (ESC, 0x1B) is the prefix for the ANSI escape sequences that colourise terminal output. The standard is ECMA-48 (1976), later mirrored as ANSI X3.64 and folded into ISO/IEC 6429. The grammar is ESC [ + parameters + a final letter; the ESC [ part is called the Control Sequence Introducer (CSI) and is written variously as \e[, \x1b[, or \033[ depending on the language. Common Select Graphic Rendition codes:
0: reset / normal ·1: bold ·4: underline ·7: reverse video30–37: foreground colour (black, red, green, yellow, blue, magenta, cyan, white)40–47: background colour (same order)90–97/100–107: bright foreground / background
So printf '\033[1;31mERROR\033[0m' prints "ERROR" in bold red and resets afterward. Every modern terminal emulator (and the Windows Terminal since 2019) supports these.
ASCII vs Unicode and UTF-8
ASCII defines 128 code points; Unicode 16.0 (released 2024) covers more than 154,000. The crucial bridge is UTF-8, the dominant text encoding on the web (used by ~98% of websites in 2026): UTF-8 is designed so that any 7-bit ASCII byte (0x00–0x7F) encodes the same character it always did, with the high bit zero. The practical consequence is that every valid ASCII file is also a valid UTF-8 file, byte-for-byte identical. Codepoints above 127 are encoded as multi-byte sequences (2 to 4 bytes) with the high bit set on every byte, which guarantees that legacy ASCII parsers never confuse them for ASCII characters.
ASCII in Common Programming Languages
| Language | Code → character | Character → code |
|---|---|---|
| JavaScript | String.fromCharCode(65) | 'A'.charCodeAt(0) |
| Python | chr(65) | ord('A') |
| C / C++ | (char)65 | (int)'A' |
| Java | (char) 65 | (int) 'A' |
| Rust | char::from(65) | 'A' as u32 |
| Go | string(rune(65)) | int('A') |
| Bash / sh | printf '\x41' | printf '%d' "'A" |
| HTML | A or A | - |
| URL encoding | %41 = "A", %20 = space | - |
The Case-Bit Trick
A small but elegant property of the ASCII layout: an uppercase letter and its lowercase counterpart differ in exactly one bit. A is 65 = 0100 0001; a is 97 = 0110 0001. Only bit 5 differs. That makes case-insensitive comparison a single bitwise operation, x | 0x20 forces lowercase, x & 0xDF forces uppercase, both faster than a lookup table. This was a deliberate design choice in the 1967 revision and is one reason the layout looks "random" in places: it encodes hardware-friendly properties, not just alphabetical order.
Common Pitfalls
- Confusing the digit 0 with the NUL control character. NUL is code 0; the character "0" is code 48. The two are not interchangeable in any programming language.
- Assuming a byte is a character. Only true for ASCII text. UTF-8 text has variable-width characters, so byte length and character count can differ wildly for non-Latin scripts.
- Mixing line endings inside one file. Mixed CR / LF / CRLF inside the same file confuses many parsers and produces phantom blank lines or missing newlines depending on which OS opens it.
- Off-by-one in C string termination. Forgetting that strings need an extra byte for the trailing NUL is the original buffer-overflow vulnerability.
- "Extended ASCII" assumed to be portable. Codes 128–255 mean different characters under Latin-1, Windows-1252, KOI8-R, Mac Roman, etc. UTF-8 is the only safe modern choice.
- Embedded ESC in untrusted input. If you log user-supplied data to a terminal without sanitising it, an attacker can inject ANSI escape sequences that change colour, move the cursor, or clear the screen, sometimes hiding malicious content.
Frequently Asked Questions
Why does DEL have code 127 instead of 0?
Because 127 in binary is 1111111: all seven bits set. To delete a character on punched paper tape, the operator backed the tape up and pressed RUB OUT, which punched through every existing hole. The receiver was supposed to ignore any byte that was all-1s, so the "deleted" character became invisible on subsequent reads. The convention was inherited from earlier teletype codes.
What is "extended ASCII" and is it safe to use?
Standard ASCII covers code points 0–127 (7 bits). "Extended ASCII" loosely refers to 8-bit encodings that fill code points 128–255 with additional characters, Latin-1, Windows-1252, KOI8-R, Mac Roman, and many others. The catch: the extra characters mean different things in each encoding. The name is technically a misnomer (those code pages are not extensions of the ASCII standard), and they are not safe across systems. UTF-8 is the modern, portable replacement and is backwards-compatible with the original 0–127 range.
Why is space (32) considered "printable" if it doesn't show anything?
Because it occupies horizontal space on a printed line, it advances the print head exactly the way a letter does. Control characters by contrast change device state without producing visible output (BEL beeps, BS moves the head backwards, LF advances paper). The classification is based on what the character does on a printer, not on whether it has a glyph.
Are CR and LF the same as Enter on my keyboard?
Mostly yes, but the byte your keyboard generates depends on the OS. On Windows, pressing Enter typically produces CRLF (0x0D 0x0A); on Linux and modern macOS, just LF (0x0A); on classic Mac OS pre-X, just CR (0x0D). Many editors normalise this on save based on the file's existing line endings or the configured project convention.
Why are the file/group/record/unit separators in here?
They were designed for record-oriented tape storage in the 1960s, File > Group > Record > Unit. They mostly fell out of use, but they have come back in two surprising places: RFC 7464 "JSON Text Sequences" (media type application/json-seq) uses RS (0x1E) as a prefix to delimit streamed JSON records, and the GS1 Application Identifier separator in retail barcode protocols uses GS (0x1D).
Is ASCII still relevant in 2026?
Very. Every modern protocol that is "text-based" (HTTP headers, JSON, YAML, source code, command-line arguments, environment variables, DNS hostnames) operates within the ASCII range. UTF-8 is the dominant encoding for arbitrary text, but UTF-8's first 128 byte values are exactly ASCII, byte-for-byte. Knowing the table is still required for anything from URL encoding to terminal colour to debugging text-encoding bugs.