Unicode Escape Converter

Convert text to UTF-16 or code-point escapes with an optional non-ASCII policy and reversible preview.

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

Page guide

How to use this tool

  1. Enter the source in the input field.
  2. Choose UTF-16 units or braced code points when encoding. Enable Escape only non-ASCII characters to retain ordinary ASCII.
  3. Valid input updates after a brief typing pause. You can also use the main action button. Resolve errors before copying or downloading.
  4. Clear input keeps the conversion settings; Undo input change restores the previous inputs after clear or reverse. Reset restores the example and default settings.

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😀. Encoding A😀 as code points with the non-ASCII option produces A\u{1F600}; decoding 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.

The non-ASCII policy still escapes backslashes so literal escape-looking text survives reversal. Decoding accepts either supported form regardless of the selected encoding style.

  • 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.

Why is a backslash escaped when only non-ASCII characters is enabled?

Every backslash starts an escape during decoding. Escaping literal backslashes preserves source text such as a written Unicode sequence when you reverse the conversion.

Sources and further reading

Reviewed on