TextyConverterbeta
⌘K

Unicode Escape

Escape non-ASCII characters as JavaScript-style \uXXXX or \u{XXXXX} sequences.

0 characters
0 characters

About Unicode Escape

Unicode escape converts non-ASCII characters into JavaScript-style escape sequences: characters in the BMP (Basic Multilingual Plane) become \uXXXX, and characters outside the BMP — emoji, mathematical symbols, etc. — become \u{XXXXX}. ASCII characters pass through unchanged. The output is safe to paste into JavaScript, JSON, or any context that understands these escapes.

When to use it

  • Producing JSON that uses ASCII-only string literals
  • Embedding non-ASCII text into a code file that requires ASCII
  • Inspecting the code points behind a string
  • Pasting Unicode into systems that mangle multi-byte characters

How it works

Each Unicode code point in the input is checked: ASCII (< 0x80) is passed through, BMP characters are emitted as \uXXXX with 4 hex digits, and astral-plane code points are emitted as \u{...} with the minimum digits needed.

Examples

café 🎉
caf\u00e9 \u{1f389}

Frequently asked questions

Does the output work in JSON?
The \uXXXX form is valid JSON. The \u{...} form is JavaScript ES6+ only — JSON requires the surrogate pair (\uD83C\uDF89). Toggle modes if you need strict JSON compatibility.
Are control characters escaped?
Only non-ASCII (≥ U+0080). Control characters in the ASCII range (tab, newline, etc.) pass through. To escape those too, use JSON.stringify.

Related tools