Encoding

Unicode Escape/Unescape

Convert text to \uXXXX escape sequences and back, including emoji and surrogate pairs. Runs entirely in your browser; nothing you type is ever sent anywhere.

Plain Text
Escaped (\uXXXX)
Escaped output will appear here.

Quick Learn

A \uXXXX escape represents one UTF-16 code unit as four hex digits — the same escape syntax JSON and JavaScript string literals use internally. Most characters (Latin letters, common symbols, most non-English scripts) fit in a single code unit, so café becomes caf\u00e9. Characters outside the Basic Multilingual Plane — most emoji included — need two UTF-16 code units, called a surrogate pair, so a single 🚀 becomes two escapes: \ud83d\ude80. That's normal, not an error; concatenated together, those two code units represent exactly one character.

You'll also sometimes see \u{XXXXX} — ES6's code-point escape syntax, valid in modern JavaScript string and regex literals — which lets a single escape represent a supplementary-plane character directly, without splitting it into a surrogate pair. This tool's decoder recognizes both forms in the same input, since real-world text mixes escapes copied from JSON payloads (always \uXXXX pairs) with escapes copied from JS source code (sometimes \u{XXXXX}).

Best Practices

  • •Two adjacent \uXXXX escapes for one emoji aren't a bug — that's a surrogate pair, JavaScript's native way of representing a character outside the Basic Multilingual Plane as two 16-bit code units.
  • •JSON.stringify() escapes text this same way — pasting a JSON string value here and encoding it should reproduce recognizable \uXXXX sequences, useful for verifying what a JSON payload actually contains byte-for-byte.
  • •If you're writing the escapes into JavaScript source code by hand, \u{XXXXX} for a single emoji is more readable than the equivalent surrogate pair — but only \uXXXX pairs are valid inside a JSON string.
  • •Decoding is a good way to make an obfuscated or escaped string (e.g. from a minified bundle or a phishing email's spoofed text) human-readable again before deciding whether to trust it.

More Encoding Tools

See all Encoding tools

Frequently Asked Questions

Is my text uploaded anywhere?

No. Encoding and decoding both run entirely in your browser using native JavaScript string methods — nothing you paste is sent to a server.

Why does one emoji turn into two \u escapes?

Emoji and other supplementary-plane characters don't fit in a single 16-bit UTF-16 code unit, so JavaScript (and JSON) represents them as a surrogate pair — two \uXXXX escapes that only make sense together, in order. This is expected, not a decoding error.

What's the difference between \uXXXX and \u{XXXXX}?

\uXXXX is exactly four hex digits representing one UTF-16 code unit — the only form valid in JSON strings. \u{XXXXX} is an ES6 addition for JavaScript string/regex literals that can represent an entire code point (including supplementary-plane characters) in one escape, with a variable number of hex digits.

Does decode handle a mix of both escape forms in the same text?

Yes — the decoder recognizes \uXXXX and \u{XXXXX} escapes side by side in the same input and converts each correctly, regardless of which tool or context originally produced them.

Can this help debug a garbled JSON string?

Yes — pasting the raw escaped value here and decoding it shows you exactly what characters are encoded, which is often faster than tracing the issue through code, especially for spotting an unexpected or malicious hidden character.

Want the engineering deep-dives behind tools like this one?