Unicode escape converter
Convert text to and from \uXXXX, \u{...}, \xNN, HTML numeric and percent escapes, and list the code point and UTF-8 bytes of every character.
The result appears here.Everything you type here stays in your browser. Nothing is sent to HardenKit or to anyone else.
How to use the unicode escape converter
- Choose text to escapes, or escapes to text.
- When escaping, pick the form and whether to escape ASCII as well.
- Paste the input. The result updates as you type.
- Read the code point table to see exactly which characters are present.
About this tool
The same character can be written many ways. The letter é is \u00E9 in JavaScript and JSON, \xC3\xA9 as UTF-8 bytes in C or a Python bytes literal, é in HTML and %C3%A9 in a URL. Escapes exist so that source code, logs and protocols limited to ASCII can still carry any character. This tool converts text into each form and reads all of them back, mixed in one input.
Two units are easy to confuse. A code point is the number Unicode gives a character, such as U+1F600 for a smiling face. \uXXXX holds one UTF-16 unit of four hex digits, so characters above U+FFFF need two of them, a surrogate pair, while \u{1F600} names the code point directly. The table under the result lists every character with its code point, its UTF-8 bytes and its UTF-16 units.
For security work the table is the useful part. Filters compare strings, but attackers choose among encodings: <script> may arrive as \u003cscript\u003e in JSON or as numeric references in HTML and only become dangerous after a later layer decodes it. The table also exposes characters that are invisible or look like others, such as a zero width space, a right-to-left override or a Cyrillic letter in a Latin word.
Sources
Questions
A way to write a character using only ASCII, by giving its number. In JavaScript, Java and JSON it is a backslash, a u and four hex digits, as in \u00E9 for é. Other languages use \x for bytes, \U with eight digits, or &#...; in HTML.
\uXXXX is exactly four hex digits and holds one UTF-16 unit, so an emoji needs two of them. \u{...} takes one to six digits and names the code point itself. JSON allows only the four-digit form.
Paste the text and read the code point table. Every character gets a row, including ones that draw nothing, such as U+200B zero width space or U+202E right-to-left override. Compare the count of rows with what you see.
In JavaScript \xE9 is the code point U+00E9. In C or Python bytes it is the single byte E9, which is é in Latin-1 but an incomplete sequence in UTF-8. This tool reads runs of \x escapes as UTF-8 when they are valid and as Latin-1 otherwise.