Unicode Escape / Unescape

Convert characters into Unicode escape sequences such as é, or turn the \uXXXX sequences found in JSON and logs back into readable text. Everything runs in your browser.

What is a Unicode escape?

A Unicode escape writes a character as its code point — its number in the Unicode standard — using only ASCII. Source code, JSON and config files use escapes to carry non-ASCII characters safely, regardless of the file's encoding. For example, é is code point U+00E9, so in JavaScript or JSON you can write it as é.

Formaté😀Used in
\uXXXXé😀JSON, JavaScript, Java, C#
\u{...}\u{00E9}\u{1F600}JavaScript (ES2015+), Ruby, Rust, Swift
Pythoné\U0001F600Python, C, C++
CSS\0000E9\01F600CSS content, selectors
U+U+00E9U+1F600Specifications and documentation

Decoding \uXXXX in JSON responses

Many JSON encoders escape every non-ASCII character by default — Python's json.dumps and PHP's json_encode, for example — so an API response or log line may read "café" instead of "café". Paste it into the input box and click Decode. The decoder detects the format automatically, so \u{1F600}, \U0001F600, \x41, U+00E9 and HTML references like é can be mixed in the same text.

To stop the escaping at the source, use json.dumps(obj, ensure_ascii=False) in Python or json_encode($v, JSON_UNESCAPED_UNICODE) in PHP. JavaScript's JSON.stringify does not escape non-ASCII characters.

Why emoji become surrogate pairs

The \uXXXX form has exactly four hex digits, so it can only express code points up to U+FFFF. Characters beyond that — most emoji, and many rare CJK characters — are stored in UTF-16 as two code units called a surrogate pair. That is why 😀 (U+1F600) becomes 😀. In modern JavaScript you can write \u{1F600} instead, and Python uses the 8-digit \U0001F600.

Frequently asked questions

How do I turn é in JSON back into readable text?

Paste the text into the input box and click Decode. The decoder recognizes \uXXXX, \u{...}, \UXXXXXXXX, \xXX, U+XXXX and HTML numeric references, even when they are mixed.

Why does an emoji become two \u escapes?

\uXXXX holds only 16 bits. Characters above U+FFFF are written as a UTF-16 surrogate pair, for example 😀 for U+1F600. Choose the \u{XXXX} or Python format to get a single escape.

How do I stop JSON encoders from escaping non-ASCII characters?

In Python pass ensure_ascii=False to json.dumps; in PHP pass the JSON_UNESCAPED_UNICODE flag to json_encode.