Text to Unicode
Convert text to Unicode escapes (\uXXXX, U+, HTML entities) and back, locally.
Convert text to Unicode escapes and back
This tool converts plain text into Unicode escape sequences in four formats, JS \uXXXX, ES6 \u{...}, U+XXXX and HTML &#x…; entities, and decodes any mix of those formats back into text. It's useful when you're debugging a mangled string, building a JavaScript or CSS literal that needs an escaped character, or need to paste a code point reference into documentation. Encoding and decoding both run as string operations in your browser, so nothing you type is sent anywhere.
How to use the Text to Unicode
- Choose Text → Unicode or Unicode → Text with the mode switch.
- In encode mode, pick a format: JS \uXXXX, ES6 \u{...}, U+XXXX or HTML &#x…;.
- Type or paste your input into the left panel.
- Read the converted result on the right, or use the swap button to flip direction and feed the output back in.
- Copy the result with the copy button.
JS \uXXXX encoding works on UTF-16 code units, so a character outside the Basic Multilingual Plane, like most emoji, becomes a surrogate pair of two escapes rather than one; the ES6, U+ and HTML formats instead encode full code points, producing one escape per visible character. Decoding accepts any mixture of the four formats in the same input.
Frequently asked questions
- What's the difference between \uXXXX and \u{...} escapes?
- \uXXXX is the classic JavaScript escape and only covers one UTF-16 code unit at a time, so characters above U+FFFF need two of them as a surrogate pair; \u{...} is the ES6 code point escape and represents the full character in a single sequence.
- Can I decode HTML entities and \u escapes in the same text?
- Yes, decode mode looks for \u{...}, \uXXXX, U+XXXX, and both hex and decimal HTML entities in a single pass, so a string mixing several escape styles is converted back to plain text in one step.
- Why does an emoji produce two \uXXXX escapes instead of one?
- Emoji and other characters outside the Basic Multilingual Plane don't fit in one 16-bit code unit, so JavaScript represents them as a surrogate pair, and the JS \uXXXX format mirrors that by emitting two escapes for that single visible character.
- Is my text sent to a server to be encoded or decoded?
- No, both directions are plain string transforms that run in your browser tab using the input's character codes, so the text and its escaped form never leave your device during conversion.