T

Unicode Escape

UTF-16 escape sequences for JavaScript string literals.

Text
Loading editor…
0 B
\uXXXX
Loading editor…
0 B

Unicode Escape Converter

Converts text into \uXXXX escape sequences and back. A smiling emoji becomes \uD83D\uDE0A — the surrogate pair that represents it in UTF-16, which is the form a JavaScript, Java or JSON string literal needs.

By default ASCII characters are left as they are, so the output stays readable and only the characters that actually need escaping are converted.

How to use it

  1. Paste text containing non-ASCII characters to see its escaped form.
  2. Press Swap to turn escape sequences back into characters.
  3. Both \uXXXX pairs and the modern \u{1F60A} code point form are understood when decoding, as is \xNN.

Why emoji become two escapes

JavaScript strings are sequences of UTF-16 code units. Characters above U+FFFF — emoji, many historic scripts, some CJK extensions — do not fit in one unit and are stored as a surrogate pair. Escaping to \uXXXX therefore produces two escapes for one visible character.

The \u{...} form introduced in ES6 expresses the code point directly, and this converter decodes it, but it emits the surrogate pair form because that is what older parsers and strict JSON accept.

Frequently asked questions

Why does one emoji produce two \u escapes?

Because it is above U+FFFF and is stored as a UTF-16 surrogate pair. Both escapes together represent the single character.

Are ASCII characters escaped too?

No. Only characters outside ASCII are escaped, which keeps the output readable. The surrounding text stays exactly as you typed it.

Can I paste escapes copied from source code?

Yes. \uXXXX, \u{XXXXX} and \xNN forms are all decoded, so escapes from JavaScript, JSON, Java or Python string literals work.

Related tools

Everything on this page runs in your browser. TurboParse is a static site with no backend, so nothing you paste is uploaded, logged or stored.

Last updated .