Skip to content

Use this result well

Inputs that matter
Text or four-digit Unicode escape sequences, with Unicode Escape and the intended Encode/Decode direction selected.
Output to expect
Four-digit UTF-16 escapes or the decoded text, including surrogate pairs for characters such as emoji.
How it works
Encoding writes each UTF-16 unit as a four-digit escape. Decoding replaces those escapes once; ordinary text remains in place.
  • Escape conventions vary between JSON, JavaScript and other formats. This view does not parse an entire source document.
  • Keep the original text when exact emoji, combined characters or line endings matter.
  • Text input is limited to 2,000,000 UTF-16 units and each result to 20,000,000. Large conversions can be cancelled or retried.
  • Chains allow up to 12 steps. Intermediate previews are shortened; Copy retains the complete final result.
Was this tool helpful?

Reference & details

How it works

Four hexadecimal digits per unit

Each UTF-16 unit is written as a backslash, a lowercase u and four hexadecimal digits, with leading zeros when needed.

Surrogate pairs

Supplementary characters retain both original UTF-16 units. Decoding the emitted pair reconstructs the original character.

Format context

The view emits escapes without adding string delimiters or parsing a program. Check the syntax expected by the destination format.

Updated: September 2026

Example Scenarios

See that ASCII and non-ASCII text both receive escapes.

Input: A中

\u0041\u4e2d

Encode a character that needs two UTF-16 units.

Input: 😀

Two four-digit escapes, representing UTF-16 units D83D and DE00.

Encode the backslash and each following character in literal text.

Input: \u0041

\u005c\u0075\u0030\u0030\u0034\u0031

FAQ

No. Every UTF-16 unit is encoded. For example, A becomes \u0041 and 中 becomes \u4e2d.

Characters such as 😀 use two UTF-16 units. Its units are U+D83D and U+DE00, written as two four-digit escapes. One four-digit escape cannot represent the whole character.

No. The output is the sequence of escapes only. Add the surrounding syntax required by the format where you use it.

Yes. A line feed becomes \u000a and a backslash becomes \u005c. The encoder preserves their UTF-16 values.

No. It converts the text units it receives, including an unpaired surrogate if one is present. It does not parse a source file or normalize combined characters.

About Unicode Escape Encoder

Convert all entered text into four-digit Unicode escapes, including ordinary ASCII letters. Each UTF-16 unit becomes one escape; emoji outside the basic range use a surrogate pair. The page opens with Unicode Escape and Encode selected.