EthicalFusion

Text to ASCII Codes

Convert text into its ASCII/Unicode character codes, separated by spaces.

Was this tool helpful?

Thanks for the feedback!

This converter replaces every character of your text with its numeric character code in decimal, separated by spaces, so Hello becomes 72 101 108 108 111. It is handy for learning how computers store text, for debugging strange characters in data, and for preparing values for code that works with character codes.

What the numbers mean

ASCII assigns the numbers 0 to 127 to English letters, digits, punctuation and a set of control characters. A few landmarks make the table easy to remember:

CharactersCodes
Space32
Digits 0 to 948 to 57
Capitals A to Z65 to 90
Small letters a to z97 to 122
Tab, line break9, 10

Every small letter is exactly 32 more than its capital, which is why converting case in old programs was a matter of adding or subtracting 32. The digit characters are not their own values: the character "0" is code 48.

Worked example

Input Aa Zz 09 followed by a tab and ! gives:

65 97 32 90 122 32 48 57 9 33

Spaces show up as 32 and the tab as 9, so invisible characters become visible. That is the main debugging use: if a value that looks like "Delhi" fails to match, converting it may reveal a hidden 160 (non-breaking space) or 8203 (zero-width space) that you cannot see on screen.

Characters beyond ASCII

The tool is not limited to ASCII. For anything else it outputs the character's code in JavaScript's UTF-16 encoding, which for most characters equals its Unicode code point:

  • é gives 233, ₹ gives 8377 (U+20B9) and the Hindi letter न gives 2344.
  • Emoji and other characters above code point 65535 are split into two numbers called a surrogate pair. 😀 gives 55357 56832, not its code point 128512.
  • Hindi syllables are several codes each: a consonant, a vowel sign and sometimes a virama, so a short word can produce five or six numbers.

Keep in mind that these are character codes, not bytes. In UTF-8 the rupee sign takes three bytes, which is a different set of numbers entirely.

Using the output

An empty input shows the message "Enter some text." instead of a result. Output is always decimal and space-separated; there is no option for hexadecimal or comma separators. For hex values use the text to hex converter, and to turn a list of codes back into readable text, paste them into ASCII Codes to Text, which also reassembles emoji surrogate pairs. Students comparing number systems can take the same text through the binary converter to see each code in base 2.

Frequently asked questions

What is the ASCII code for a space?
A space is code 32. A tab is 9 and a line break is 10.
Why does an emoji give two numbers?
Emoji are stored as a surrogate pair in UTF-16, and the tool prints the code of each half. The pair converts back to the emoji correctly.
What does the tool show for the rupee sign?
It shows 8377, the decimal value of the Unicode code point U+20B9.
Can I get hexadecimal codes instead of decimal?
No, this tool outputs decimal only. Use a text to hex converter for hexadecimal values.
Why is the code for the digit 0 not zero?
Digits are characters with their own codes. The character 0 is 48, 1 is 49 and so on up to 9 at 57.

Related tools

Embed this tool on your site

Paste it into any blog or website. Free, with a credit link.