๐ค ASCII Table Reference: Decimal, Hex, Octal, Binary and HTML Codes
By ToolNimba Web Dev Team ยท Updated 2026-06-24
| Dec | Hex | Oct | Binary | Char | Name / description |
|---|
Codes 0 to 31 and 127 are non-printing control characters, shown by their abbreviation. Code 32 is the space, shown as SP. Click any row to copy the field selected above.
This ASCII table lists every character from 0 to 127 with its decimal, hexadecimal, octal and binary code, the printable glyph, and the name of each control code. Type into the search box to filter by a number (in any base) or by the character itself, then click any row to copy the value you need. It is handy whenever you are debugging encodings, escaping characters, or just want to look up the code for a letter or symbol.
What is the ASCII Table?
ASCII (the American Standard Code for Information Interchange) is a character encoding that maps the numbers 0 to 127 onto letters, digits, punctuation and a set of control codes. It was first standardised in 1963 by the American Standards Association, revised in 1967 and again in 1986, and it remains the foundation of modern text. The first 128 code points of UTF-8 and Unicode are byte-for-byte identical to ASCII, so a plain ASCII file is also a valid UTF-8 file. Because every code fits in 7 bits, ASCII is compact, unambiguous and supported on essentially every computer, language and protocol in use today.
The 128 codes split into two groups. Codes 0 to 31, plus 127, are control characters: they were never meant to be printed but to control devices such as teleprinters, modems and terminals. Familiar examples are 9 (horizontal tab), 10 (line feed, the newline on Unix, Linux and macOS) and 13 (carriage return, which Windows pairs with line feed to end a line). Codes 32 to 126 are the printable characters: 32 is the space, 48 to 57 are the digits 0 to 9, 65 to 90 are the uppercase letters A to Z, and 97 to 122 are the lowercase letters a to z. Code 127 (DEL) is technically a control code even though it sits at the very end.
A few patterns make ASCII easy to reason about and to compute by hand. Uppercase and lowercase letters are exactly 32 apart, so you can switch case by adding or subtracting 32, or by flipping a single bit (bit 5, value 32). The digit characters are deliberately not equal to their numeric values: the character '0' is code 48, so to turn a digit character into the number it represents you subtract 48. The letters are laid out in order, which is why A is 0x41 and a is 0x61, and why sorting ASCII strings byte by byte happens to sort uppercase before lowercase and both after the digits.
Web developers meet ASCII in a second guise: HTML character references. Any character can be written in a web page as a numeric reference using its decimal code (for example A for A) or its hex code (A), and a handful of ASCII characters that are special in HTML have named entities instead, such as & for the ampersand (38), < for the less-than sign (60) and " for the double quote (34). The reference table below lists these so you can paste the right code into markup without guessing. Programmers also reach for ASCII through escape sequences such as \n (line feed, 10), \t (tab, 9), \r (carriage return, 13) and \0 (the null terminator, 0).
Beyond the original 128 codes lie the so called extended ASCII sets, which use the eighth bit to define codes 128 to 255. These were never part of the ASCII standard itself: they are separate code pages such as Windows-1252, IBM code page 437 and the ISO 8859 family (with ISO 8859-1, also called Latin-1, being the most common). Different code pages assign completely different characters to the same numbers, which is exactly why a document can look fine on one machine and turn into mojibake on another. If you need accented letters, currency symbols or anything outside English, the modern answer is to use Unicode and encode it as UTF-8 rather than relying on an extended ASCII page.
In short, ASCII is small, old and astonishingly durable. It defines just 128 codes, but those codes underpin source code, network protocols, file formats and almost every keyboard you will ever touch. Whether you are escaping a character for a URL, hunting down a stray control byte that broke a CSV import, or teaching how computers store text as numbers, the table below gives you the decimal, hex, octal, binary and HTML value for every code in one place.
When to use it
- Looking up the decimal, hex, octal or binary code for a character while writing or debugging code.
- Identifying a mysterious control character (such as a stray tab, null or carriage return) that is breaking a parser, CSV import or log file.
- Building escape sequences, URL-encoded strings or regular expressions that need the exact hex value of a character.
- Finding the correct HTML numeric reference or named entity (&, <, >, ") to safely place a special character in markup.
- Teaching or learning how text is represented as numbers, including the 32-apart case shift and the 48 offset on digits.
- Converting a character to its code in any base, or back again, without reaching for a separate calculator.
How to use the ASCII Table
- Scroll the table to browse all 128 ASCII characters from 0 to 127.
- Type a number (for example 65, 0x41, 0o101 or 1000001) or a character into the search box to filter the rows.
- Choose which field you want to copy (character, decimal, hex, octal or binary) from the dropdown.
- Click a row, or focus it and press Enter, to copy that field to your clipboard.
- Use the reference tables further down for control-code names, HTML codes and the difference between ASCII and extended ASCII.
Formula & method
Worked examples
Find every code for the uppercase letter A.
- A is the first uppercase letter; its decimal code is 65.
- Hex: 65 in base 16 = 41 (4 x 16 + 1 = 65).
- Octal: 65 in base 8 = 101 (1 x 64 + 0 x 8 + 1 = 65).
- Binary: 65 in base 2 = 1000001, padded to 8 bits = 01000001.
- HTML: the numeric reference is A in decimal or A in hex.
Result: A = decimal 65, hex 0x41, octal 101, binary 01000001, HTML A
Convert the uppercase letter M to its lowercase form using codes.
- M has decimal code 77.
- Lowercase letters sit 32 codes after their uppercase pair.
- 77 + 32 = 109.
- Decimal 109 is the character m.
Result: M (77) + 32 = 109 = m
Turn the digit character '7' into the number 7.
- The character '7' is not the value 7; its ASCII code is 55.
- The digit characters '0' to '9' run from code 48 to 57.
- Subtract the code for 0 (48): 55 - 48 = 7.
- The result 7 is now a usable numeric value.
Result: '7' (55) - 48 = 7
Safely write an ampersand and a less-than sign in HTML.
- The ampersand is decimal 38; writing a bare & can break the markup.
- Use the named entity & or the numeric reference &.
- The less-than sign is decimal 60 and would start a tag if left bare.
- Use the named entity < or the numeric reference <.
Result: & becomes & (or &), < becomes < (or <)
Key ASCII ranges and what they cover
| Decimal range | Type | Contents |
|---|---|---|
| 0 to 31 | Control | Non-printing codes such as NUL, tab (9), line feed (10) and carriage return (13) |
| 32 | Printable | Space (SP) |
| 33 to 47 | Printable | Punctuation and symbols: ! " # $ % & and so on |
| 48 to 57 | Printable | Digits 0 to 9 |
| 58 to 64 | Printable | Symbols: colon, semicolon, less-than, equals, greater-than, question mark, at sign |
| 65 to 90 | Printable | Uppercase letters A to Z |
| 91 to 96 | Printable | Symbols: opening bracket, backslash, closing bracket, caret, underscore, backtick |
| 97 to 122 | Printable | Lowercase letters a to z |
| 123 to 126 | Printable | Symbols: opening brace, vertical bar, closing brace, tilde |
| 127 | Control | DEL (delete) |
Common control codes you will actually meet
| Dec | Hex | Abbr | Escape | Meaning |
|---|---|---|---|---|
| 0 | 00 | NUL | \0 | Null, often a string terminator in C |
| 7 | 07 | BEL | \a | Bell, triggers an alert sound |
| 8 | 08 | BS | \b | Backspace |
| 9 | 09 | HT | \t | Horizontal tab |
| 10 | 0A | LF | \n | Line feed, the newline on Unix, Linux and macOS |
| 11 | 0B | VT | \v | Vertical tab |
| 12 | 0C | FF | \f | Form feed, page break |
| 13 | 0D | CR | \r | Carriage return, paired with LF on Windows |
| 27 | 1B | ESC | \e | Escape, starts terminal escape sequences |
| 127 | 7F | DEL | Delete |
HTML codes for special and common ASCII characters
| Char | Dec | Hex | HTML numeric | HTML named |
|---|---|---|---|---|
| space | 32 | 20 |   | (non-breaking) |
| " | 34 | 22 | " | " |
| & | 38 | 26 | & | & |
| ' | 39 | 27 | ' | ' |
| < | 60 | 3C | < | < |
| > | 62 | 3E | > | > |
| A | 65 | 41 | A | none (use the letter) |
| a | 97 | 61 | a | none (use the letter) |
Common mistakes to avoid
- Treating a digit character as its number. The character '5' is code 53, not the value 5. To get the numeric value from a digit character you subtract 48 (the code for '0'). Forgetting this is a classic off-by-48 bug.
- Confusing CR and LF. A newline is line feed (code 10) on Unix, Linux and macOS, but Windows ends lines with carriage return then line feed (codes 13 and 10). A stray CR is a frequent cause of files that look fine but break parsers, diffs and shell scripts.
- Assuming ASCII covers accented or non-English letters. ASCII only defines codes 0 to 127, so characters like the e-acute, n-tilde or pound sign are not in it. Those come from extended ASCII code pages or from Unicode. If you see odd symbols, the text is probably UTF-8 being read as plain ASCII, or one code page being read as another.
- Mixing up the case-shift direction. Uppercase codes are lower than lowercase: A is 65 and a is 97. To go from uppercase to lowercase you add 32, not subtract it. Reversing the sign turns letters into unrelated punctuation and symbols.
- Treating extended ASCII as a single fixed standard. There is no one extended ASCII table. Codes 128 to 255 mean different things in Windows-1252, code page 437 and ISO 8859-1. Relying on a specific code page in a file that may be opened elsewhere is a common source of corrupted text.
- Forgetting to escape special characters in HTML or URLs. Characters such as & (38), < (60) and the space (32) have special meaning in markup and URLs. Writing them raw can break a page or a link. Use the HTML entity (&, <) or the percent-encoded hex (%20 for a space) instead.
Glossary
- ASCII
- The American Standard Code for Information Interchange, a 7-bit encoding mapping codes 0 to 127 to characters.
- Control character
- A non-printing code (0 to 31 and 127) that signals an action, such as a tab, newline or bell, rather than a visible glyph.
- Printable character
- A code from 32 to 126 that represents a visible glyph or the space.
- Hexadecimal
- Base 16 notation, using digits 0 to 9 and letters A to F. ASCII codes are often shown this way, for example A as 0x41.
- Octal
- Base 8 notation, using digits 0 to 7. ASCII codes appear in octal in older C escape sequences and Unix tools, for example 101 for A.
- Code point
- The numeric value assigned to a character. In ASCII the code points run from 0 to 127.
- Extended ASCII
- Any 8-bit encoding that keeps ASCII for codes 0 to 127 and adds its own characters for 128 to 255, such as Windows-1252 or ISO 8859-1. Not part of the ASCII standard itself.
- HTML entity
- A way to write a character in HTML using a code, either a numeric reference like A or a named one like &, so special characters do not break the markup.
- UTF-8
- A Unicode encoding whose first 128 code points are identical to ASCII, so plain ASCII text is valid UTF-8. It is used by the vast majority of web pages.
Frequently asked questions
What is an ASCII table?
An ASCII table lists the 128 characters of the ASCII standard alongside their numeric codes. This one shows the decimal, hexadecimal, octal and binary value for each character (0 to 127), plus the name of every control code and the matching HTML reference, so you can look up or convert any character quickly.
How many characters are in ASCII?
Standard ASCII defines 128 characters, numbered 0 to 127. Codes 0 to 31 and 127 are control characters, code 32 is the space, and codes 33 to 126 are printable letters, digits and symbols. Encodings that add codes 128 to 255 are called extended ASCII and are not part of the original standard.
What is the ASCII code for A?
The uppercase letter A has the decimal code 65, which is 0x41 in hexadecimal, 101 in octal and 01000001 in binary. The lowercase a is 32 higher at decimal 97 (0x61). Its HTML reference is A. You can search for either letter in the table above to copy any of these values.
What are control characters?
Control characters are codes 0 to 31 plus 127 that were designed to control devices rather than print a glyph. Common ones include tab (9), line feed (10, the newline), carriage return (13), null (0) and escape (27). The reference table shows their abbreviation, escape sequence and a short description.
How do I convert a character to its ASCII code?
Find the character in the table and read off the code in the base you need, or search by the character to filter to its row. In code, most languages expose this directly: charCodeAt in JavaScript, ord() in Python, or a cast to int in C and Java all return the decimal code.
What is the difference between ASCII and Unicode?
ASCII is a small 7-bit set of 128 characters. Unicode is a vastly larger standard covering every writing system, emoji and symbol, with over a million possible code points. Crucially, the first 128 Unicode code points match ASCII exactly, so ASCII is effectively a subset of Unicode and any ASCII text is also valid UTF-8.
What is extended ASCII?
Extended ASCII refers to 8-bit encodings that keep the original 128 ASCII codes and use the eighth bit to add codes 128 to 255 for accented letters, symbols and box-drawing characters. There is no single extended ASCII table: Windows-1252, IBM code page 437 and ISO 8859-1 all assign different characters to those upper codes, which is why text can look garbled when opened with the wrong code page.
Why is the character 0 not equal to the number 0?
The character '0' has ASCII code 48, while the number zero is the value 0. The digit characters '0' to '9' were placed at codes 48 to 57 on purpose so that subtracting 48 from a digit character gives its numeric value. This 48 offset is why parsing a digit means code minus 48.
What is the ASCII code for a space and a newline?
The space character is decimal 32 (0x20). The newline is line feed, decimal 10 (0x0A), on Unix, Linux and macOS, while Windows uses carriage return (13) followed by line feed (10). In code these are written as the escape sequences \n for line feed and \r for carriage return.
How do I write an ASCII character in HTML?
Use a numeric character reference with the decimal code, such as A for A, or the hex code, such as A. A few characters that are special in HTML have named entities instead: & for the ampersand (38), < for less-than (60), > for greater-than (62) and " for the double quote (34).