Unicode Escape Converter

Encode text as JavaScript-style Unicode escapes, or decode \uXXXX and \u{...} sequences into readable text.

Text is processed locally in your browser and is not uploaded.

How to use this tool

  1. Choose Encode text or Decode escapes and enter the source.
  2. When encoding, choose four-digit UTF-16 units or braced Unicode code points. The style control does not restrict decoding.
  3. Select Convert Unicode escapes. Decoding accepts ordinary characters alongside supported escapes but rejects other backslash escape forms.

Understanding the output

UTF-16 mode emits four hexadecimal digits for every code unit. Characters outside the Basic Multilingual Plane become a pair of surrogate escapes. Code-point mode emits one braced sequence per Unicode scalar value. Decoding combines valid surrogate pairs and preserves ordinary characters between escapes.

One letter and one emoji

A😀 becomes \u0041\uD83D\uDE00 in UTF-16 mode, or \u{41}\u{1F600} in code-point mode. Decoding either representation restores A😀.

Code units and code points describe different layers

JavaScript strings use UTF-16 code units. A code point above U+FFFF requires two of those units, known as a surrogate pair. A four-digit escape represents a code unit, so an emoji can require two escapes even though it is one code point. The braced form directly identifies the scalar value and makes that distinction visible.

Neither representation guarantees one escape per visible character. Combining accents and joined emoji sequences can contain several code points. Escaping changes how text is written in source; it does not normalize composed and decomposed spellings into one form.

Use the escape grammar expected by the destination

JavaScript code-point escapes and JSON string escapes are not interchangeable. JSON accepts four-digit Unicode escapes inside a quoted string, but does not accept braced code-point escapes. This tool emits Unicode sequences without wrapping quotes or escaping a complete JSON string. Choose a full string-escaping tool when the destination expects a JSON value.

Method and supported input

Encoding walks UTF-16 units or Unicode code points and writes hexadecimal notation. Decoding reads only \u followed by four hexadecimal digits or a braced value with one to six digits. The completed output must contain no unpaired surrogates.

  • Backslashes in decode mode introduce Unicode escapes; this is not a general JavaScript string parser.

Limitations

  • Backslash-n, backslash-x, escaped quotes, and other non-Unicode escape forms are rejected.
  • Code points above U+10FFFF and standalone surrogate values are rejected. No Unicode normalization is performed.

Common questions

Why does an emoji produce two four-digit escapes?

Its code point needs two UTF-16 code units. Use code-point mode to write one braced escape for that scalar value.

Can I decode mixed text and escapes?

Yes. Ordinary characters are retained. Every backslash must begin one of the two supported Unicode escape forms.

Will these escapes work inside JSON?

Four-digit escapes are supported inside JSON strings, but braced escapes are not. Use JSON String Escape when you need surrounding quotes and all JSON escape rules.

Sources and further reading