JavaScript to Unicode Escape screenshot

JavaScript to Unicode Escape

Turn text into JavaScript \uXXXX escapes in your browser. Every UTF-16 code unit is escaped, including surrogate pairs.

Privacy First
0 Runs
Updated 2026-11-06
No upload
Instant
No signup

What this javascript to unicode escape does

Each UTF-16 code unit becomes a four-digit \u escape, so ordinary letters are escaped too and the result is pure ASCII. An emoji becomes a surrogate pair of two escapes, which is exactly what a JavaScript string literal contains.

How to use it

JavaScript to Unicode Escape: paste the text into the box above, and press Run to get the JavaScript escapes below.

Worked example

Input:

Hi ✓

Output:

\u0048\u0069\u0020\u2713

Why it runs in your browser

The conversion happens on this page with JavaScript. Your input is not posted to a server, so it works offline after the page loads and nothing is retained anywhere. The page reads text and returns JavaScript escapes; reloading the page discards both.

Each UTF-16 code unit becomes a four-digit \u escape, so ordinary letters are escaped too and the result is pure ASCII. An emoji becomes a surrogate pair of two escapes, which is exactly what a JavaScript string literal contains.

Turn text into JavaScript \uXXXX escapes in your browser. Every UTF-16 code unit is escaped, including surrogate pairs.

How to use it

JavaScript to Unicode Escape: paste the text into the box above, and press Run to get the JavaScript escapes below.

Why it runs in your browser

The conversion happens on this page with JavaScript. Your input is not posted to a server, so it works offline after the page loads and nothing is retained anywhere. The page reads text and returns JavaScript escapes; reloading the page discards both.

What to Expect

Best for

  • Converting text to JavaScript escapes when the data is already on screen.

What this tool keeps

  • Your input is not posted to a server, so it works offline after the page loads and nothing is retained anywhere.

Sample input

Hi ✓

Sample output

\u0048\u0069\u0020\u2713

Frequently asked questions

How do I use the javascript to unicode escape?

JavaScript to Unicode Escape: paste the text into the box above, and press Run to get the JavaScript escapes below.

Is my input uploaded?

No. The text is parsed on this page with JavaScript and is never posted to a server.

Is there a size limit?

Yes: 5 MB per run. Larger input is refused with a message rather than freezing the tab.

Developer program

Build custom tools for your store

Join the SDK program to create useful ecommerce utilities for your store.