How do you convert decimal codes to ASCII text?
Each decimal number stands for one character, so you look up every number and write down its character: 72 is H, 105 is i. This converter does the lookup for a whole list at once. Paste numbers separated by spaces or line breaks and it returns the text, using ASCII for 0 to 127 and Unicode code points above that.
Try 80 121 116 104 111 110. The output is Python.
Where these numbers usually come from
Most decimal code lists are printed by a program, and each language has its own pair of functions for going between characters and numbers. Knowing which one produced your list matters, because some return code points and some return bytes or UTF-16 units:
| Language | Character to number | Number to character | What the number is |
|---|---|---|---|
| Python | ord('é') gives 233 |
chr(233) |
Unicode code point (docs) |
| JavaScript | codePointAt(0) |
String.fromCodePoint() |
Unicode code point (MDN) |
| JavaScript | charCodeAt(0) |
String.fromCharCode() |
UTF-16 code unit |
| PHP | ord('é') gives 195 |
chr() |
A single byte, so only the first UTF-8 byte |
| PHP | mb_ord('é') gives 233 |
mb_chr() |
Unicode code point (manual) |
| Python | list('é'.encode()) gives 195, 169 |
bytes([...]).decode() |
UTF-8 bytes |
This tool behaves like the code point rows: it is the equivalent of mapping String.fromCodePoint over your list. Output from any of the code point functions pastes straight in. For plain English text all the rows agree, because ASCII characters have the same number in every scheme.
Decoding a list from a log or a debugger
- Copy the numbers. If they came from an array like
[72, 101, 121], strip the brackets and commas first, since only whitespace is accepted as a separator. A find and replace of,with a space does it. - Paste them into the input box. Line breaks between numbers are fine, and extra spaces are ignored.
- Click Convert.
- If the result has odd pairs like
éwhere you expected accented letters or symbols, your list is UTF-8 bytes rather than code points. See the next section.
Bytes versus code points
This is the mistake behind most "wrong character" results. Compare two lists that both claim to spell café:
| Input | Output | Why |
|---|---|---|
99 97 102 233 |
café | 233 is the code point of é |
99 97 102 195 169 |
café | 195 and 169 are the two UTF-8 bytes of é, each read as its own character |
The second list is perfectly valid UTF-8, just in the wrong form for this tool. 195 happens to be the code point of à and 169 of ©, so you get the classic garbled look. To decode byte lists properly, convert each byte to hex and use hex to text, which reassembles multi-byte UTF-8 sequences. The encoding rules themselves are in RFC 3629.
UTF-16 lists have a similar quirk. JavaScript's charCodeAt reports an emoji as two numbers, a surrogate pair. The tool recognises a complete pair and joins it: 55357 56397 decodes to 👍, the same as the single code point 128077.
Range and validation
The tool accepts whole numbers from 0 to 1114111, the full Unicode code space ending at U+10FFFF. Inside that range every number produces a character, including ones you might not expect:
- 0 to 31 and 127 are control codes. 9 is a tab and 10 starts a new line; most others are invisible in the output box.
- 128 to 159 are also control characters in Unicode, not printable symbols.
The exception is 55296 to 57343, the surrogate halves. They only mean something as a high-then-low pair, as above, so one on its own (say
55296, or56397 55357in the wrong order) is rejected with an error naming the number.
Input is rejected with "Enter space-separated decimal ASCII codes, e.g. 72 105." if any item contains something other than digits: a comma, a minus sign, a decimal point, a letter or a 0x prefix. Leading zeros are allowed, so 072 105 still gives Hi.
A number above 1114111 gets its own message, such as "1114112 is not a valid character code — Unicode code points run from 0 to 1114111." Whatever the error, the output box is cleared, so a stale result from an earlier conversion is never left on screen.
Going the other way
To produce a code list from text, use ASCII to decimal. For hexadecimal codes, which is what most byte dumps use, hex to ASCII is the matching decoder.
Last updated