decoder.tools

Unicode Escape Decoder

Decode \uXXXX, \u{…} and \xNN escape sequences into readable Unicode text.

INPUT
OUTPUT

The result appears here as you type.

Decoding runs in your browser. What you paste is not sent to a server.

A Unicode escape decoder replaces escape sequences such as é, \u{1F680} and \x41 with the characters they encode, turning escaped source-code strings back into readable text.

Example

Input
Café ☕ \u{1F680} \x41
Output
Café ☕ 🚀 A

Where these escapes come from

Programming languages and data formats escape characters that are awkward to type or that the file encoding can't hold:

  • \uXXXX (exactly four hex digits) is used by JSON, JavaScript, Java and C#. It names a UTF-16 code unit, so characters outside the Basic Multilingual Plane, such as most emoji, need a surrogate pair: 🚀 is 🚀.
  • \u{XXXXX} (one to six hex digits) is the ES2015 JavaScript form. It takes the full code point, so 🚀 is simply \u{1F680}.
  • \xNN (two hex digits) is a single byte or Latin-1 character in JavaScript, Python and C.

You typically see these when a JSON file was written with ASCII-only output (Python's json.dumps does this by default), in minified JavaScript, in log files and in API responses viewed raw.

How to use the Unicode escape decoder

  1. Paste the escaped string. You can include the surrounding text.
  2. Read the decoded result. All three escape styles are converted in one pass.
  3. Surrogate pairs such as 🚀 combine into a single emoji automatically.

Decode Unicode escapes in code

Python
import json

print(json.loads('"Caf\\u00e9 \\u2615 \\ud83d\\ude80"'))  # Café ☕ 🚀
JavaScript (Node.js)
console.log(JSON.parse('"Caf\\u00e9 \\u2615 \\ud83d\\ude80"')); // Café ☕ 🚀

Unicode escapes at a glance

\uXXXXUTF-16 code unit (JSON, JavaScript, Java, C#)
\u{X…}Full code point, 1 to 6 hex digits (JavaScript ES2015+)
\xNNOne byte / Latin-1 character (JavaScript, Python, C)
Characters above U+FFFFNeed a surrogate pair with \uXXXX

Frequently asked questions

Why does an emoji become two \u escapes?

\uXXXX can only express values up to U+FFFF. Emoji live above that, so UTF-16 splits them into two code units called a surrogate pair. 🚀 is the pair for 🚀 (U+1F680).

How do I stop Python from writing \u escapes in JSON?

Pass ensure_ascii=False to json.dumps. The output then contains the actual characters, which is fine as long as the file is saved as UTF-8.

Is é the same as é or %C3%A9?

They all mean é, written for different contexts: é in source code and JSON, é in HTML (use the HTML entity decoder) and %C3%A9 in URLs (use the URL decoder).

Last reviewed · found a mistake? contact@decoder.tools · view as markdown