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

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

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