Unicode Escape / Unescape
Turn non-ASCII text into \uXXXX, \u{X} or U+XXXX escape sequences, or decode escapes back into readable characters. \xNN and \UXXXXXXXX forms are understood when unescaping.
Use the tool
Why this tool exists
Source files, JSON payloads and config formats sometimes need pure ASCII, which means accented letters and emoji must be written as escapes. The other way round, logs and API responses are full of \u00e9 and \ud83d\ude00 that nobody can read at a glance.
This tool escapes every character outside ASCII in the style you choose, and optionally ASCII too. Characters above U+FFFF become surrogate pairs in the \uXXXX style, which is how JavaScript and JSON expect them. Unescaping accepts several syntaxes in one pass. It is all done in your browser, so nothing is uploaded.
How to use it
- Pick the direction: escape or unescape.
- For escaping, choose a style: \uXXXX, \u{X} or U+XXXX.
- Paste your text into the box, and tick "Escape ASCII too" if every character should be escaped.
- Copy the converted text.
Frequently asked questions
Which style should I use?
\uXXXX works in JSON and in every JavaScript version, using two escapes for characters above U+FFFF. \u{X} is shorter and valid in modern JavaScript and Rust. U+XXXX is only a notation for documents and is not valid code.
Why does one emoji produce two escapes?
In the \uXXXX style, characters above U+FFFF are written as a UTF-16 surrogate pair, such as \ud83d\ude00. That is how JSON and older JavaScript represent them. Use \u{X} for a single escape.
What does unescape understand?
\u{1F600}, \u00e9, \xe9, \U0001F600 and U+00E9. Any other backslash sequences, such as \n, are left untouched, so this is not a full string unescaper.
Will it change normal ASCII text?
Not unless you tick "Escape ASCII too". By default, letters, digits and punctuation in the ASCII range are copied as they are, so the output stays easy to read.