Text to ASCII
Convert text to code points in any notation, and decode them back again.
Output updates as you type.
Features
- Six output notations including JS and HTML escapes
- Decodes every notation back to text
- Per-character table with code point, hex and UTF-8 length
- Correct handling of emoji and astral-plane characters
- Custom separator between values
How to use it
- Choose whether you are encoding or decoding.
- Type or paste your input.
- Pick the notation you need.
- Copy the result or study the breakdown table.
ASCII, Unicode and the difference between them
ASCII defines 128 characters numbered 0 to 127, the English alphabet, digits, common punctuation and a set of control codes. It was designed for teleprinters in the early 1960s, which is why it contains oddities like the bell character and why carriage return and line feed are separate. Everything in that range still has the same number today, which is why ASCII text is valid in essentially every encoding in use.
Unicode extends that to over 150,000 characters covering every living script, historical alphabets, mathematical symbols and emoji. A Unicode code point is written U+ followed by hex, so U+0041 is the letter A and U+1F30D is the Earth globe emoji. Code points above U+FFFF are the astral planes, and they are where naive string handling falls over.
The distinction that causes most bugs is between code points and encoded bytes. UTF-8 stores a code point in one to four bytes, ASCII characters take one, most European accented letters two, most CJK characters three, and emoji four. JavaScript strings, meanwhile, are UTF-16, storing astral characters as two 16-bit surrogates. So a single emoji has one code point, four UTF-8 bytes, and a JavaScript .length of 2. The table below shows all three so the discrepancy is visible.
Frequently asked questions
Related tools
Further reading
Read the full guide on the 123MiniApps blog.