ASCII to text: decode character codes
The ASCII to text converter reads a list of numeric character codes and returns the text they spell. Codes can come from programming exercises, String.fromCharCode calls, database dumps, spreadsheets or puzzles.
Example
Input:
72 101 108 108 111 32 65 83 67 73 73 33Output:
Hello ASCII!The numbers 65 to 90 are the uppercase letters and 97 to 122 the lowercase ones, so a list mostly in those ranges is almost certainly ordinary text.
Flexible input
- Separate codes with spaces, commas, semicolons or line breaks. Brackets and braces are ignored, so array literals paste straight in.
- Choose the notation with the Code format option, which applies in both directions. Individual values can override it with a prefix:
0x48is always hex and0b1001000always binary. - HTML numeric references such as
HiorHare recognised automatically. - Codes above 127 are treated as Unicode code points, up to U+10FFFF, so values such as 233 (é), 8364 (€) or 128512 (😀) work too.
Examples in other notations
| Notation | Input | Output |
|---|---|---|
| Hex | 0x48 0x69 | Hi |
| Octal | 110 151 | Hi |
| Binary | 1001000 1101001 | Hi |
| HTML | Hi | Hi |
Troubleshooting
- “… is not a valid base-10 number”. The input contains letters — probably hex codes. Switch the notation to Hex.
- Unexpected symbols. Octal and decimal look alike; “110” is “n” in decimal but “H” in octal. Check which notation your source uses.
- UTF-8 bytes instead of code points. If the numbers came from a byte array (for example 195 169 for “é”), decode them with Byte to String instead; here they would become “é”.
The same in code and spreadsheets
JavaScript: String.fromCodePoint(72, 105). Python: ''.join(map(chr, [72, 105])). Java: (char) 72 for a single character. Excel and Google Sheets: =CHAR(72) for codes up to 255 and =UNICHAR(8364) for any Unicode character. This tool is quicker when you have a whole list of codes to decode at once.
Common sources of code lists include programming exercises, CTF puzzles, obfuscated scripts that build strings from numbers, and data exported from systems that store characters as integers.
Go the other way with Text to ASCII Codes. The decoder runs in your browser.
Control codes you may meet
Codes 0 to 31 and 127 are control characters rather than letters. Most of them have no visible shape, so when a decoded result seems to have odd gaps, stray line breaks or “missing” characters, look for these values in your list:
| Code | Hex | Meaning |
|---|---|---|
| 0 | 0x00 | NUL, often a string terminator or padding |
| 9 | 0x09 | Horizontal tab |
| 10 | 0x0A | Line feed, the Unix line break |
| 13 | 0x0D | Carriage return, paired with 10 on Windows |
| 27 | 0x1B | Escape, the start of terminal colour codes |
| 127 | 0x7F | Delete |
Code 32 is the ordinary space. A list that ends in 13 10 simply finishes with a Windows line break.
ASCII to text in Python
In Python, chr() turns one character code into a character, so converting a list is a join over the split input; pass a base to int() for hex, octal or binary codes. The mistake to avoid is feeding UTF-8 byte values to chr(). It works on Unicode code points, so the bytes 195 169 come out as é; build a bytes object and call decode("utf-8") to get é.
codes = "72 101 108 108 111 32 65 83 67 73 73 33"
text = "".join(chr(int(code)) for code in codes.split())
print(text)
# hex codes: pass the base to int()
hex_codes = "48 65 6c 6c 6f"
print("".join(chr(int(code, 16)) for code in hex_codes.split()))
# chr() takes code points, so UTF-8 byte values need bytes().decode()
print("".join(chr(n) for n in [195, 169]))
print(bytes([195, 169]).decode("utf-8"))
The converter above gives the same results for these inputs; for byte values, use Byte to String.