Unicode Escape Converter

Encode text as Unicode escapes or decode explicit backslash-u escapes, supporting UTF-16 pairs and braced code points.

Text processing stays in this browser. Input is limited to 20,000 UTF-16 code units.

Encoding escapes every character. Decoding accepts only backslash-u escapes; other literal characters pass through. Other backslash sequences are rejected.

Convert explicit Unicode escape notation

This converter turns text into backslash-u escapes or converts those escapes back to text. It is useful for sharing a precise character sequence in a code review or debugging a string that contains invisible characters. It is not a JavaScript interpreter, a JSON parser, a URL decoder or an HTML entity decoder.

Encode every character

Enter text, set Direction to Encode text, select Encoding format, and press Process text. The default UTF-16: \uXXXX writes one four-digit escape per UTF-16 code unit. Code points: \u{X} writes one braced escape per Unicode code point. Both formats escape ordinary ASCII characters and spaces as well as non-ASCII text.

For the loaded example A😀, UTF-16 output is \u0041\uD83D\uDE00. Code-point output is \u{41}\u{1F600}. The emoji uses a surrogate pair in the first format and a single scalar value in the second. No surrounding quote characters are added. A literal backslash is encoded too, so an input that already looks like an escape is treated as ordinary text during encoding.

Decode a narrow, predictable grammar

Set Direction to Decode escapes and paste an escaped sequence. Encoding format is disabled because decoding accepts both supported forms in the same input. Four-digit escapes require exactly four hexadecimal digits; braced escapes accept one to six. Non-backslash characters pass through unchanged. Decoding makes one pass and does not reinterpret a backslash produced by that pass.

hello \u0041 becomes hello A. \uD83D\uDE00 and \u{1F600} both become 😀. Values above U+10FFFF are rejected. A four-digit surrogate escape must produce a valid adjacent pair in the decoded output; \uD800 alone is rejected. Braced escapes must be scalar values, so \u{D800} is invalid even when followed by another surrogate escape.

Other backslash sequences, including \n, \t, \x41 and doubled backslashes, are unsupported and produce an error. Encode a line feed as \u000A or insert the actual line break instead. Removing quotes from a JSON string is not enough to make every JSON escape acceptable here. The notation and surrogate distinction are explained in MDN's lexical grammar reference.

Check before copying into another format

Copy full result copies the complete output and Download result writes UTF-8 TXT. The summary counts code points in the output text, including the literal notation characters when encoding; it is not a count of decoded symbols. Input is limited to 20,000 UTF-16 code units, while encoded output can be longer. Browser textareas may normalize pasted line endings before conversion.

Some target formats accept only four-digit escapes or need additional quotation and escaping. Choose the format required by that target rather than assuming braced escapes work everywhere. For a readable diagnostic list of values and offsets, use the Unicode Code Point Inspector. To understand why several decoded values appear as one symbol, open the Grapheme Cluster Viewer.