Unicode Converter
Convert text to Unicode escapes in 8 notations (JS \uXXXX, ES6 \u{}, U+, HTML, code points) and decode any of them back — surrogate-correct for emoji. Live, with a per-character code-point inspector.
About this ToolHow it works, benefits & use casesTap to collapse
This converter turns text into Unicode escape sequences in eight different notations and decodes any of them back to characters. Encode to JS/JSON \uXXXX (valid JavaScript and JSON, astral characters emitted as surrogate pairs so they round-trip exactly), ES6 \u{X} one-escape-per-code-point, CSS-style \XXXX, the standard U+ notation, HTML hex (&#xXXXX;) or decimal (&#NNNN;) references, or bare hex (0xXXXX) and decimal code-point lists. Crucially it is surrogate-correct: emoji and other characters outside the basic plane are handled by code point, not split incorrectly the way a naive charCodeAt approach would. The decoder auto-detects mixed input — \uXXXX, \u{}, \xXX, U+, &#x;, &#;, and bare code-point lists — and reassembles the text without throwing. A live code-point inspector table breaks down each character into its code point, decimal value, UTF-8 bytes, and UTF-16 units. It runs entirely in your browser.
How to Use
- 1Choose "Encode (text → Unicode)" or "Decode (Unicode → text)" with the toggle.
- 2When encoding, pick a notation from the Output format dropdown (JS \uXXXX, ES6 \u{}, CSS, U+, HTML hex/decimal, or code points).
- 3Type or paste your text — when encoding, the result and a per-character code-point inspector update live.
- 4When decoding, paste any mix of escape formats; the tool auto-detects and converts them to text.
- 5Click Convert to confirm, then copy, download, swap input ↔ output, or share the link.
Key Benefits
- Eight output notations: JS \uXXXX, ES6 \u{}, CSS, U+, HTML hex/decimal, and code-point lists
- Surrogate-correct — emoji and astral characters encode and decode without breaking
- JS/JSON output round-trips exactly as valid JavaScript escapes
- Decoder auto-detects mixed \uXXXX, \u{}, \xXX, U+, &#x;, &#; and bare code points
- Never-throws decoding leaves unrecognized fragments intact
- Live code-point inspector showing decimal, UTF-8 bytes, and UTF-16 units per character
- Two-way conversion with swap and a shareable URL
Common Use Cases
- Generating \uXXXX escapes to embed non-ASCII text safely in source or JSON
- Reading the exact code point and UTF-8 bytes of an emoji or unfamiliar glyph
- Producing HTML numeric character references for portable markup
- Decoding escaped strings copied from logs, JSON, or another language’s source
- Debugging encoding issues by inspecting UTF-16 surrogate pairs of a character
Output format
Valid JavaScript/JSON escapes; astral chars emit a surrogate pair. Round-trips exactly.
0 code points · live
Valid JavaScript/JSON escapes; astral chars emit a surrogate pair. Round-trips exactly.
Enter text above to see its Unicode escapes.
Was this tool helpful?
Share Your Experience
Help others discover this tool!
Related tools
- Color ConverterConvert between HEX, RGB, HSL, and HSV
- cURL to Code ConverterConvert cURL commands to code in various languages
- HTML to MarkdownConvert HTML to Markdown
- JSON to CSVConvert JSON to CSV format
- npm to Yarn ConverterConvert npm commands and package-lock.json to Yarn equivalents
- Postman to cURL ConverterConvert Postman requests to cURL commands
Characters beyond U+FFFF (like most emoji) are stored in JavaScript as two UTF-16 code units called a surrogate pair. A naive converter using charCodeAt(0) would only capture the first half and corrupt the character. This tool works per code point, so encoding then decoding an emoji returns the exact same character. The JS/JSON notation deliberately emits the surrogate pair so it stays valid JavaScript.
Decoding auto-detects and accepts \uXXXX, \u{...}, \xXX, U+XXXX, HTML hex (&#xXXXX;), HTML decimal (&#NNNN;), and bare lists of 0x.. / U+.. / decimal code points separated by spaces or commas. You can even mix several formats in one input — anything it does not recognize is left unchanged rather than causing an error.

