Unicode Escape Encoder & Decoder

Encode text as \uXXXX, \xXX, or HTML hex entities, and decode escaped strings back to readable text for code, JSON, and config work.

This conversion runs only in your browser — nothing is uploaded.

\uXXXX uses UTF-16 code units (emoji → surrogate pairs). Hex is UTF-8 bytes (\xXX). HTML is &#x…; numeric entities.

  • Input0
  • Output0
  • OptionsUnicode (\uXXXX)

Input

Output

What is this tool?

This Unicode escape encoder and decoder converts readable text to escape notations used in JavaScript/JSON strings, byte-level debugging, and HTML numeric entities — then decodes them back.

  • Unicode (\uXXXX) — UTF-16 code units (JSON / JS string style). Supplementary characters such as emoji become surrogate pairs.
  • Hex (\xXX) — UTF-8 bytes, useful when a log shows raw byte escapes.
  • HTML (&#x…;) — hexadecimal numeric character references.

Escaping is not encryption. Anyone can reverse the result. Conversion updates live and stays in your browser.

Common use cases

  • Read \uXXXX sequences from API or application logs
  • Prepare JSON/JS string escapes that include CJK or emoji
  • Compare UTF-16 escapes with UTF-8 \xXX bytes for the same character

How to use

  1. Choose Encode or Decode. Results update as you type; changing the format re-runs immediately.
  2. Pick Unicode, Hex, or HTML to match the source you are debugging.
  3. Paste text or escapes. Sample loads 안녕 😀 (or the matching escaped form).
  4. Copy the output. Meta chips show character counts and a short U+ code-point preview.

Examples

Input / settingOutputNotes
Hi → Unicode encode\u0048\u0069Each BMP character becomes one \uXXXX.
Hi → Hex encode\x48\x69UTF-8 bytes for ASCII (same values as code points here).
\uD83D\uDE00 → Unicode decode😀Surrogate pair → U+1F600 (edge vs single \uXXXX).
A → HTML decodeAHexadecimal HTML entity back to a character.

Practical pitfalls

  • Do not expect a single \uXXXX for emoji; JSON-style escapes use UTF-16 surrogates.
  • Mixing formats fails silently or empties output — Hex will not decode \u sequences, and Unicode will not parse \x bytes.
  • HTML mode here is numeric &#x…; only, not named entities like   (use the HTML Entity tool for named forms).

References

Last reviewed: 2026-07-26

Frequently asked questions

Why does an emoji become two \uXXXX escapes?
JavaScript and JSON \uXXXX escapes are UTF-16 code units. Characters outside the Basic Multilingual Plane (including many emoji) need a high/low surrogate pair, for example \uD83D\uDE00 for 😀 (U+1F600), not a single four-digit escape.
What is the difference between Unicode, Hex, and HTML formats?
Unicode mode emits \uXXXX (UTF-16 units). Hex mode emits \xXX for each UTF-8 byte. HTML mode emits hexadecimal numeric entities like 😀. Pick the format that matches the log, language, or markup you are reading.
Why does decoding fail or look empty?
The selected format must match the input. Pasting \u escapes while Hex is selected, truncated surrogate pairs, or incomplete \x / &#x…; sequences will not decode cleanly. Switch format or fix the escapes.
Does the text leave my browser?
No. Encoding and decoding run only client-side.