🔤

Unicode Escape Converter

Convert text to Unicode escape sequences (\uXXXX and \u{XXXXX} ES6) and back. Handles surrogate pairs for emoji, supports bidirectional text-to-escape and escape-to-text conversion.

Converted
Plain text
11 chars
Unicode escapes
32 chars

About Unicode Escape Converter

Unicode escape is the practice of representing Unicode characters as ASCII sequences such as `\uXXXX` or `\u{1F600}`, widely used in source code, JSON, config files and cross-language data exchange. Characters outside the Basic Multilingual Plane (code points above U+FFFF, such as emoji and rare CJK ideographs) require a surrogate pair - two `\uXXXX` units - for example the emoji 😀 is `\uD83D\uDE00`. This tool performs bidirectional conversion: escape any text (including Chinese, emoji and combining characters) into `\u` sequences, or restore escape sequences back to readable text, correctly splitting and merging surrogate pairs. All conversion runs locally in the browser, supporting UTF-16 surrogate pairs and ES6 code-point form (`\u{1F600}`). It is ideal for development debugging, log cleanup, and i18n copy handling.

How to Use

  1. Open the Unicode Escape Converter tool page
  2. Enter or paste your data into the input area
  3. View the real-time results and use the copy button to get the output

Use Cases

  • Embedding Non-ASCII in Source — Escape Chinese, emoji and other characters into `\uXXXX` for source code, avoiding mojibake or compile errors from encoding issues.
  • JSON Data Processing — JSON allows `\uXXXX` escapes; converted text transmits safely with special characters intact and stays compatible with older parsers.
  • Log & Error Triage — Restore escaped Chinese in logs to readable text to locate errors fast, or escape sensitive characters before writing them to logs.
  • i18n Copy — Store multilingual strings as `\u` sequences in i18n resource files to prevent display glitches from inconsistent file encodings.
  • Emoji Debugging — Inspect the surrogate-pair composition of emoji to fix front-end rendering, character counting and truncation bugs caused by unhandled pairs.

FAQ

What is a surrogate pair?

In UTF-16, characters with code points above U+FFFF (such as emoji) are represented by two 16-bit units called a surrogate pair. 😀 is `\uD83D\uDE00` and must be parsed as a pair.

Does it support \u{XXXXXX} code-point form?

Yes. The tool can output ES6-style `\u{1F600}` code-point form and parse it back to characters, compatible with modern JavaScript and Python.

Will conversion lose characters?

No. The tool uses standard UTF-16 encoding and decoding, fully preserving all Unicode characters including combining marks, zero-width characters and astral-plane characters.

Can it handle partially escaped text?

Yes. When decoding, it recognises `\uXXXX` sequences in the text and replaces them while leaving unescaped portions intact — ideal for cleaning partially escaped logs.

Is data uploaded?

No. All escaping and restoring happens locally in the browser; text content is never sent to any server.

Why does escaped Chinese look so long?

Each Chinese character occupies one `\uXXXX` (4 hex digits), so a run of Chinese produces many escape sequences. It looks long but restores identically.

Comments

No comments yet. Be the first!

💬 Comments are stored locally in your browser. Configure Giscus for cloud-based comments.