Encoding / Decoding

Unicode Escape

Convert text to/from Unicode escape sequences (\uXXXX).

Original
Escape result

What is Unicode Escape?

Unicode escape represents characters as \uXXXX (UTF-16) or \UXXXXXXXX (code point) format, useful for representing non-ASCII characters in code, regex, or protocols.

Use Cases

  • Unicode characters in regular expressions
  • Non-ASCII strings in APIs or config files
  • XSS prevention and special character filtering

Frequently Asked Questions

What is the relationship between \uXXXX escapes and UTF-8 bytes?
\uXXXX is the hexadecimal form of a UTF-16 code unit, not a UTF-8 byte. Characters in the BMP map one-to-one, but characters outside it (most emoji) are surrogate pairs: 😀 is \uD83D\uDE00. This tool shows the code point (U+1F600) and the UTF-8 bytes together so the two concepts stay distinct.
Why does an emoji become two \u escapes?
JavaScript strings are UTF-16: characters beyond U+FFFF require a pair of surrogate code units. ES6 added the \u{1F600} braced syntax that writes by code point directly, and this tool can output either format.
When do I actually need Unicode escapes?
Typical cases: carrying text through configs or protocols that only accept ASCII; debugging strings that look identical but compare unequal (invisible characters, full-width versus half-width); reading console output full of \u sequences. Escaping makes invisible differences visible.