Unicode Escape & Unescape

Convert text to Unicode escape sequences like \u0041, or decode escape sequences back to characters.

Features

\uXXXX format
\UXXXXXXXX format
&#xHHHH; format
&#DDDD; format

How to Use

1. Pick Escape or Unescape mode.

2. Paste your text into the input.

3. The result appears on the right — click Copy.

About this tool

Unicode escapes let you write any character using only ASCII, which is useful in source code, JSON, configuration files and HTML where the exact bytes matter. This tool converts text to four formats and back: \uXXXX as used in JavaScript, JSON and Java, where characters beyond U+FFFF such as emoji become surrogate pairs; \UXXXXXXXX with eight hex digits for the full code point, as in Python and C; and the HTML numeric references &#xHHHH; and &#DDDD;. Only non-ASCII characters are escaped, so ordinary letters and digits stay readable. Unescaping recognises the chosen format and turns sequences back into characters, and if you paste escaped text in escape mode, the tool switches direction automatically.

Frequently Asked Questions

What is the difference between \u and \U escapes?
\u is followed by four hex digits and represents one UTF-16 code unit, so characters above U+FFFF need two escapes (a surrogate pair). \U is followed by eight hex digits and represents a full code point directly, as supported by Python and C.
Why does an emoji become two \u escapes?
Emoji such as 😀 (U+1F600) are outside the Basic Multilingual Plane. In UTF-16, used by JavaScript and Java, they are stored as a high and a low surrogate, for example \ud83d\ude00.
When should I use &#x; or &#; in HTML?
With UTF-8 pages you can usually write characters directly. Numeric references are useful when a system strips non-ASCII text, when you need an invisible character such as a non-breaking space, or in XML files with a restricted encoding.
Is Unicode escaping the same as URL encoding?
No. URL encoding turns the UTF-8 bytes of a character into %XX sequences, so é becomes %C3%A9. Unicode escaping writes the code point, so é becomes \u00e9 or é.
Why do some escaped strings not convert back?
The sequences must match the selected format exactly. A lone surrogate, missing digits, or mixing formats such as \u00e9 with é in the same text will leave those parts unchanged.

Related Tools