FormatterHQ

ASCII Table

All 128 ASCII characters with decimal, hexadecimal, octal and binary values, HTML numeric codes and plain-English names for control characters — searchable, with click-to-copy.

Loading tool…
Ready.

How to use the ASCII Table

  1. Scroll the table or type in the search box — a character, a code (e.g. 41) or a word like "tab".
  2. Tick Include extended 128–255 to show the ISO-8859-1 (Latin-1) range.
  3. Click any cell to copy its value.

The complete ASCII table

ASCII (American Standard Code for Information Interchange) assigns numbers 0–127 to letters, digits, punctuation and control codes. Published in 1963, it is still the foundation of text encoding: the first 128 code points of Unicode and UTF-8 are identical to ASCII. This ASCII table lists every character with its decimal, hexadecimal, octal and binary value, its HTML numeric reference and a description.

How the table is organised

  • 0–31 and 127 — control characters: non-printing codes from the teleprinter era. The ones you still meet daily are 9 (TAB, \t), 10 (LF, \n), 13 (CR, \r), 27 (ESC, used in terminal colour codes) and 0 (NUL, the C string terminator).
  • 32 — space.
  • 48–57 — digits 0–9 (hex 30–39), so a digit's value is its code minus 48.
  • 65–90 — uppercase A–Z and 97–122 — lowercase a–z. Upper- and lowercase differ by exactly 32 (one bit, 0x20), which is why case conversion is a single bit flip.
  • Punctuation and symbols fill the gaps.

Extended ASCII

ASCII is a 7-bit code; values 128–255 are not ASCII at all. Many "extended ASCII" code pages filled them differently. With the option enabled, the table shows ISO-8859-1 (Latin-1), which matches the first 256 Unicode code points. Windows-1252 is almost identical but places characters such as €, “ ” and — in the 128–159 range, where Latin-1 has control codes — a frequent source of garbled text.

Line endings

Unix, Linux and macOS end lines with LF (10); Windows uses CR LF (13 10). Mixed line endings are behind many "invisible" diff changes and script errors like bad interpreter: /bin/bash^M, where ^M is the carriage return.

Convert text to codes with text to ASCII and back with ASCII to text, or look up any Unicode character with the Unicode character inspector.

ASCII in programming

Many everyday tricks rely on the table's layout: checking whether a character is a digit by comparing it with 48 and 57, converting a letter to lowercase by adding 32, or sorting strings "ASCIIbetically", where uppercase letters come before lowercase ones and "Z" sorts before "a". Knowing the hexadecimal values also helps when reading hex dumps, URL encodings such as %20 for space, and escape sequences like \x1B for ESC.

Control keys and the ASCII table

Holding Ctrl on a terminal keyboard clears the two high bits of a letter's code, so Ctrl plus a key sends that character's code minus 64. This explains several shortcuts that still work in every shell:

KeysCodeNameTypical effect
Ctrl+C3ETXInterrupt the running program
Ctrl+D4EOTEnd of input on Unix terminals
Ctrl+H8BSBackspace
Ctrl+I9HTTab
Ctrl+M13CREnter, and the ^M seen in Windows files
Ctrl+Z26SUBSuspend a job on Unix; end of file in the Windows console
Ctrl+[27ESCEscape, handy in Vim

The caret notation in the last column is the same idea written down: ^M means “the character you get with Ctrl+M”.

Privacy

The tool runs entirely in your browser. Nothing you type or paste is sent to our servers.

Print an ASCII table in Python

An ASCII table in Python is a loop over the code numbers: chr(code) gives the character, and format codes print the same number in hex (02X), octal (03o) and binary (08b). ord() is the reverse lookup. The loop below covers 32 to 126, because codes 0–31 and 127 are control characters with nothing visible to print. Keep in mind that chr() and ord() cover all of Unicode, not only ASCII: chr(233) returns é without complaint, so use str.isascii() when the distinction matters.

print("Dec  Hex  Oct  Binary    Char")
for code in range(32, 127):
    char = "SP" if code == 32 else chr(code)
    print(f"{code:3d}  {code:02X}   {code:03o}  {code:08b}  {char}")

# Lookups in both directions
print(ord("A"), chr(97), hex(ord("~")))   # 65 a 0x7e

# chr() is not limited to ASCII, so test the range yourself
print(chr(233), "é".isascii(), "e".isascii())   # é False True

The decimal, hex and octal columns it prints match the table on this page, which also names the control characters.

Frequently asked questions

How many characters are in ASCII?
128, numbered 0 to 127: 33 control characters (0–31 and 127) and 95 printable characters including the space.
What is the ASCII code for A?
Uppercase A is 65 (hex 41) and lowercase a is 97 (hex 61).
Is extended ASCII the same as UTF-8?
No. Extended ASCII refers to various 8-bit code pages. UTF-8 matches ASCII for 0–127 but encodes everything else with two to four bytes.
What is the difference between LF and CR?
LF (10) moves to a new line and CR (13) returns to the line start. Unix systems use LF alone; Windows uses CR followed by LF.

Last updated October 3, 2026

Related tools