This ASCII table lists all 128 ASCII characters with their decimal, hexadecimal, octal and binary codes, the HTML reference for each, and the name, caret notation and escape sequence of every control character. Click any value to copy it, filter to just the control codes, letters, digits or punctuation, and use the converter under the table to turn text into ASCII codes or a list of codes back into text.
ASCII itself only covers 0 to 127. The codes from 128 to 255, often called extended ASCII, are not one standard, so instead of picking one the second table shows the three versions you are likely to meet: Windows-1252, which is what Windows' Alt+0nnn codes and most “Latin-1” web pages really use; true ISO-8859-1, which has invisible control codes at 128–159; and the original IBM PC code page 437 with its box-drawing characters. If you have bytes from a file, knowing which of the three it was written in is what decides the character.
How to use
- Find the character in the table, or use the filter chips to show only control codes, letters, digits or punctuation.
- Click any decimal, hex, octal, binary, character or HTML value to copy it.
- For bytes above 127, check the extended table and pick the column for the encoding your text uses (Windows-1252 if unsure).
- To convert a string, type it in the Text box and choose decimal, hex, octal or binary output; to decode, paste codes into the Codes box.
Frequently asked questions
What is ASCII?
ASCII (American Standard Code for Information Interchange) is a 7-bit character code with 128 positions: 33 control codes (0–31 and 127) and 95 printable characters (32–126) covering the space, digits, English letters and common punctuation. It was first published in 1963, gained lowercase letters in 1967 and was last revised as ANSI X3.4-1986. Unicode and UTF-8 keep its first 128 characters unchanged.
What are the ASCII codes for A, a, 0 and space?
Capital A is 65 (hex 41), small a is 97 (hex 61), the digit 0 is 48 (hex 30) and the space is 32 (hex 20). Upper- and lowercase letters are exactly 32 apart, a single bit (0x20), and each digit's code is 48 plus its value, which is why code like c - '0' converts a digit character to its number.
Is extended ASCII (128–255) a standard?
No. ASCII is 7-bit and ends at 127. The upper half of an 8-bit byte was filled differently by different code pages: Windows-1252 and ISO-8859-1 for Western European text, code page 437 on the IBM PC, and many others for Greek, Cyrillic or Central European languages. Byte 233 is é in Windows-1252 and ISO-8859-1 but Θ in code page 437. Today, text should be stored as UTF-8 instead.
What is the difference between ASCII and UTF-8?
UTF-8 is a Unicode encoding that is backwards compatible with ASCII: the 128 ASCII characters are stored as the same single bytes, so a pure ASCII file is also valid UTF-8. Characters beyond ASCII take two to four bytes; é becomes C3 A9 and an emoji takes four bytes. Reading those bytes as Windows-1252 is what produces mojibake such as “é” for “é”.
What do \n, \r and \t mean in the ASCII table?
They are escape sequences for control codes: \n is Line Feed (10, 0x0A), \r is Carriage Return (13, 0x0D) and \t is Horizontal Tab (9). Linux and macOS end lines with LF, Windows with CR LF, and the classic Mac OS used CR alone. Other escapes are \0 for NUL (0), \a for Bell (7), \b for Backspace (8), \v for Vertical Tab (11) and \f for Form Feed (12).
How do I get the ASCII code of a character in code?
In JavaScript use 'A'.charCodeAt(0) (or codePointAt for characters beyond U+FFFF) and String.fromCharCode(65) to go back. In Python use ord('A') and chr(65). In C a char already is its code: (int)'A' is 65. Excel has =CODE("A") and =CHAR(65), though those use the system code page for values above 127.
How the ASCII table is laid out
The 128 codes fall into four rows of 32, and the layout was designed so that simple bit operations do useful work.
• 0–31: control codes. Holding Ctrl on a terminal clears bit 0x40 of the key, so Ctrl+M (77 → 13) sends Carriage Return and Ctrl+[ (91 → 27) sends Escape. That is where caret notation such as ^M and ^[ comes from.
• 32–63: space, punctuation and digits. The digits 0–9 are 48–57 (0x30–0x39), so the low four bits of a digit are its value.
• 64–95: @, the capital letters A–Z (65–90) and [ \ ] ^ _.
• 96–127: `, the small letters a–z (97–122), { | } ~ and DEL. Each lowercase letter is its capital plus 32, so flipping bit 0x20 changes case.
DEL is 127, all seven bits set, because on punched paper tape a mistaken character could be erased by punching out every hole.
Control characters you still run into
Most of the 33 control codes were for teleprinters and serial links and are unused today, but a handful matter in everyday programming.
• LF (10) and CR (13): line endings. A file with Windows CR LF endings opened on Linux shows ^M at line ends; git's core.autocrlf setting and most editors convert between the two.
• HT (9): the tab. TSV files and Makefiles depend on a real tab, not spaces.
• NUL (0): ends strings in C. A stray NUL in user input can truncate a string in C-based code and is a classic source of bugs.
• ESC (27): starts ANSI escape sequences, such as \x1b[31m for red text in a terminal.
• ETX (3), EOT (4) and SUB (26): what Ctrl+C, Ctrl+D and Ctrl+Z send. A Unix terminal turns Ctrl+C into an interrupt signal and Ctrl+D into end of input; Ctrl+Z marked end of file in DOS text files.
• BEL (7): printing it makes many terminals beep or flash.
Windows-1252, ISO-8859-1 and code page 437 compared
ISO-8859-1 (Latin-1) maps byte 128–159 to the C1 control codes and 160–255 to the characters that became Unicode's Latin-1 Supplement: non-breaking space, ¡ ¢ £, the accented letters and so on. Its code points equal its byte values, which is why Unicode U+00E9 is é and byte 233 is é.
Windows-1252 is identical from 160 to 255 but replaces the mostly unused C1 controls with 27 printable characters: € ‚ ƒ „ … † ‡ ˆ ‰ Š ‹ Œ Ž ‘ ’ “ ” • – — ˜ ™ š › œ ž Ÿ. Five bytes (129, 141, 143, 144, 157) are undefined. Because so much “Latin-1” text was really Windows-1252, the WHATWG Encoding Standard tells browsers to decode both labels as Windows-1252, and HTML treats – as – for the same reason.
Code page 437 is the original IBM PC set: accented letters in a different order, Greek letters and math signs, and the box-drawing and shading characters (░ ▒ ▓ │ ┤ ╣ ║) that DOS programs drew their screens with. It survives in Windows' Alt+nnn codes and in some barcode printers, terminals and old file formats.
