Code tool

Text JS Unicode Escape

Convert text into a bounded JavaScript string escape representation in your browser.

In-browser processingNo account requiredPrivacy details ↗

Maximum 100,000 UTF-16 code units. Processing stays in your browser.

A QUICK WALKTHROUGH

How to use this tool

  1. Paste up to 100,000 UTF-16 code units of text.
  2. Choose whether to escape printable non-ASCII characters.
  3. Review and copy the JavaScript escape output.

JavaScript UTF-16 escapes

BMP characters use one \uXXXX escape. Characters above U+FFFF use two four-digit escapes for their UTF-16 surrogate pair; the output does not use ES6 \u{...} syntax.

Safe string representation

Backslash, quote, and JavaScript line terminators are escaped so the result can be placed inside a double-quoted JavaScript string. Printable ASCII stays readable by default.

Local bounded processing

Input is limited to 100,000 UTF-16 code units and output is generated entirely in this browser. No upload, evaluation, or execution of the generated text occurs.

GOOD TO KNOW

Common questions

How are emoji escaped?

Each astral code point is emitted as two four-digit UTF-16 escapes, such as \uD83D\uDE00 for 😀.

Does this execute the result?

No. It only produces text; the output is never evaluated.