Unicode Escape & Unescape

Convert text to \uXXXX, \u{…} or U+XXXX sequences and back, with surrogate pair validation.

Options

Input

Ctrl + Enter to run

Result

Convert text into Unicode escape sequences and back. The \uXXXX format (JavaScript, JSON, Java) represents characters beyond the basic plane, such as emoji, with a surrogate pair; \u{…} (ES2015+) uses the code point directly, and U+XXXX is Unicode notation.

Unescaping validates surrogate pairs: a high surrogate without its low partner, or the other way round, is an error because it represents no character.

How to use it

  1. Choose Escape or Unescape.
  2. When escaping, pick the format and whether to convert only non-ASCII.
  3. Press Run.

Example

Example input
Señal: ¡listo! 😀
Result
Se\u00F1al: \u00A1listo! \uD83D\uDE00

Limitations

  • Other escapes such as \n or \x41 are not interpreted: only \uXXXX, \u{…} and U+XXXX (plus \\ for backslash).
  • In U+XXXX format a space follows each escape to avoid ambiguity.

FAQ

Why does 😀 become two escapes?
In UTF-16, characters above U+FFFF take two code units (a surrogate pair): \uD83D\uDE00. With \u{1F600} it is a single escape.
Why escape only non-ASCII?
To make a source or JSON file safe for systems that mishandle UTF-8 without losing readability of the ASCII text.

Related tools

References