Unicode Escape / Unescape

Free online Unicode escape and unescape. Supports \u, %u and &#x; prefixes with upper/lowercase hex, handles emoji surrogate pairs correctly. Runs in your browser.

Runs locally · data never uploaded
Advertisement

How to use

What it does

Unicode escaping represents each character by its code point. This tool supports three common prefixes:

  • \u: standard JavaScript / Java style, e.g. \u4f60\u597d.
  • %u: the non-standard %uXXXX style used by some legacy systems.
  • &#x;: HTML hexadecimal entity, e.g. 你.

Enable "Uppercase hex" to output \u4F60. Encoding handles emoji and other characters outside the Basic Multilingual Plane correctly: an emoji is split into a surrogate pair. For example 😊 encodes to \uD83D\uDE0A, and decoding merges the pair back automatically.

Example

Encoding "你好":

\u4f60\u597d

Encoding "Hi😊" gives:

Hi\uD83D\uDE0A

Common uses

  • Representing non-English strings as pure ASCII in source code
  • Inspecting the real code point of a character when debugging mojibake
  • Making configs with special symbols portable as escapes

FAQ

Q1.Why does an emoji turn into two \u sequences?
An emoji code point exceeds 0xFFFF and cannot fit in a single \uXXXX (only 4 hex digits, max 65535). UTF-16 uses a surrogate pair — a high surrogate (�–�) and a low surrogate (�–�) — so you see two \u values. This tool handles the pairing in both directions.
Q2.What is the difference between \u, %u and &#x;?
They are just different prefixes for the same code point. \u is the JS/Java standard; %u is a legacy browser style; &#x; is an HTML entity. When decoding, pick the prefix that matches your data.
Q3.Decoding gave me garbage or question marks?
Usually the code point was written wrong or the prefix mismatched. Make sure the escapes are complete, the hex is valid, and the prefix matches the original encoding. Unrecognized plain text is left untouched.
Q4.Why not just use UTF-8?
UTF-8 is right for almost everything. But in configs, logs or legacy systems that only transport ASCII, Unicode escapes keep characters intact and make them easier to debug and port.
Advertisement

Related tools