Processed in your browser

Unicode Escape Converter

Encode every non-ASCII character as JavaScript-style \uXXXX text. Characters outside the Basic Multilingual Plane use a valid UTF-16 surrogate pair. Decoding is strict and does not interpret unrelated escapes such as \n or \t.

Processed in your browser
0 / 1,000,000
Converted output

Tool guide

What is Unicode Escape Converter?

Unicode Escape Converter moves between readable text and JavaScript-style \uXXXX notation for debugging, test data, and source inspection. Characters outside the Basic Multilingual Plane use correct UTF-16 surrogate pairs. Decoding strictly checks escape length and pairing without interpreting unrelated backslash sequences. Common workflows include the following. Inspect UTF-16 escapes for Chinese text or emoji. Restore Unicode escapes found in logs or source code. Build non-ASCII compatibility test samples. The page also documents input boundaries, output behavior, and practical cautions so you can review the result before putting it into an application, configuration, test, or production workflow.

When to use it

  • Inspect UTF-16 escapes for Chinese text or emoji.
  • Restore Unicode escapes found in logs or source code.
  • Build non-ASCII compatibility test samples.

How to use it

  1. Enter plain text or a sequence containing \uXXXX escapes.
  2. Choose encode or decode.
  3. Review and copy or swap the output.
  4. Load one of the realistic examples first to verify the selected options and processing direction before replacing it with your own data.
  5. Review the output, status message, and documented limits; copy, download, or continue only after the result matches your expectation.

Runnable examples

The “Example 1” and “Example 2” buttons load the matching inputs. They cover different structures, directions, or boundaries and can be run directly in the workspace.

Example 1

JSONLane Unicode tools 🚀 support combining text é and emoji 👍🏽.

Example 2

\u004A\u0053\u004F\u004E\u004C\u0061\u006E\u0065 \u4E2D\u6587 \uD83D\uDE80

Input rules

  • Encoding accepts ordinary Unicode text.
  • For decoding, every \u must be followed by four hexadecimal digits.
  • Isolated or incorrectly paired surrogates are rejected.
  • Text input is counted before processing and is limited to 1,000,000 characters on this page; file modes apply the separate file limit shown in the workspace.
  • Encoding leaves ASCII characters unchanged and escapes every non-ASCII character.

Output rules

  • ASCII remains readable and non-ASCII becomes uppercase hexadecimal escapes.
  • Emoji and other supplementary characters become valid surrogate pairs.
  • Sequences such as \n and \t are not additionally interpreted.
  • Output reflects only the current input, direction, and options; rerun after changing a mode or value instead of treating an earlier result as current.
  • Decoding requires exactly four hexadecimal digits after every \u.

Limitations and cautions

  • Encoding leaves ASCII characters unchanged and escapes every non-ASCII character.
  • Decoding requires exactly four hexadecimal digits after every \u.
  • Isolated or incorrectly paired UTF-16 surrogate escapes are rejected.

How your data is handled

Character iteration, surrogate validation, and conversion all happen locally without execution or uploads.

FAQ

How are emoji encoded?

Non-BMP characters such as emoji become a valid pair of UTF-16 escapes, for example \uD83D\uDE80.

Will \n become a line break?

No. This tool decodes only \uXXXX sequences and leaves other backslash text unchanged.

Can decoded text execute code?

No. It remains plain text and is never evaluated or inserted as HTML.

Why can one emoji produce two Unicode escapes?

JavaScript-style \uXXXX escapes follow UTF-16, so characters outside the basic multilingual plane require a surrogate pair.

Will it convert newlines to \n?

No. This page handles Unicode escapes only; use the JSON string escape tool for newline and tab escapes.

Why reject unpaired surrogates?

An isolated surrogate is not a valid Unicode scalar and can become a replacement character or corrupted text in another system.

Updated: 2026-07-31