Guide
ASCII codes and the characters behind them
By Logappradeep · ServiceNow developer
ASCII, the American Standard Code for Information Interchange, was first published in 1963 and still forms the foundation of nearly every modern text encoding. It assigns numbers from 0 to 127 to English letters, digits, punctuation, and control characters. UTF-8 was designed so that those 128 characters keep exactly the same values, which is why plain English text is byte-for-byte identical in ASCII and UTF-8.
How the table is laid out
- 0–31: control characters, originally commands for teletypes. The ones you still meet are 9 (tab), 10 (line feed), 13 (carriage return), and 0 (null, the C string terminator).
- 32: space, the first printable character.
- 48–57: digits
0–9. Subtracting 48 from a digit's code gives its numeric value, a trick used in countless parsers. - 65–90: uppercase
A–Z. - 97–122: lowercase
a–z. - 127: DEL, another control character.
Converting Hi! produces 72 105 33, and decoding 72 105 33 gives the text back.
The case bit
Uppercase and lowercase letters are exactly 32 apart: A is 65 and a is 97. In binary, 32 is a single bit, so switching case is just flipping that bit. This is also why simple byte-order sorting places every uppercase letter before every lowercase one: Zebra (Z = 90) sorts ahead of apple (a = 97). If a list sorts in a surprising order, ASCII values are often the reason.
Practical uses
- Working with functions like
charCodeAtandString.fromCharCodein JavaScript,ordandchrin Python, orCHAR()andASCII()in SQL. - Identifying unprintable characters in input: a code of 13 at the end of each line means Windows line endings, and 9 means a tab, not spaces.
- Building keyboard handlers, simple ciphers, checksums, and protocol messages that work on character codes.
- Solving puzzles and CTF challenges that hide messages as lists of numbers.
Things that trip people up
- There is no single "extended ASCII". Codes 128–255 mean different things in Windows-1252, ISO-8859-1, and old DOS code pages. Any value above 127 is not ASCII at all; for characters such as
éyou are looking at a Unicode code point, and the bytes on disk depend on the encoding used. This converter shows such characters by their Unicode code point, such as 233 foré. - Decimal, not hex. This converter uses decimal codes. A table showing
41forAis using hexadecimal; the decimal value is 65. - Separators matter when decoding. Codes must be separated by spaces or commas, because
72105cannot be split unambiguously.
Conversion runs instantly in your browser, and nothing is uploaded.