Unicode Encoder

Runs in browser Encoding

Escape any text — including Arabic, Hindi and emoji — into JavaScript/JSON \uXXXX sequences, ES2015 \u{XXXXX} form, U+ code points or numeric entities.

Privacy: This tool runs entirely in your browser. Your input never leaves your device.
Loading tool…

How to use Unicode Encoder

  1. Paste any text — Arabic, Devanagari, emoji, accents.
  2. Pick the notation your language or file format expects.
  3. Enable "Escape ASCII too" for fully escaped strings.
  4. Copy the result; inspect the character table for surprises.

Unicode Encoder features

  • \uXXXX (JavaScript/JSON/Java), \u{…} (ES2015), U+ code points, HTML numeric entities, CSS, Python and UTF-8 byte escapes
  • Escape only non-ASCII characters or everything
  • Correct surrogate pairs for emoji and other astral characters
  • Character table with code point, script, category, UTF-8 and UTF-16 bytes
  • Counts code points, UTF-16 units and UTF-8 bytes

Unicode Encoder example

Escape an emoji for JSON

Input:

Go 🚀

Output:

Go \ud83d\ude80

Frequently asked questions about Unicode Encoder

Why does an emoji become two \u escapes?

JSON and classic JavaScript escapes address UTF-16 code units. Characters above U+FFFF, such as 🚀 (U+1F680), are stored as a surrogate pair — \ud83d\ude80. The \u{1F680} form (ES2015) writes the code point directly.

Which format does JSON accept?

Only \uXXXX with exactly four hex digits (surrogate pairs for astral characters). \u{…} is valid in JavaScript source but not in JSON.

What is the U+ notation for?

It is the standard way to name code points in documentation and bug reports (e.g. U+0645 ARABIC LETTER MEEM). It is not a string escape.

What does the character table show?

Every non-ASCII character with its code point, script and general category, UTF-8 bytes and UTF-16 units — handy for spotting look-alike characters, zero-width joiners and combining marks.

Technical notes

JavaScript strings are sequences of UTF-16 code units, so classic \u escapes need two units for characters above U+FFFF. The tool computes the surrogate pair arithmetically ((cp − 0x10000) >> 10 + 0xD800, (cp − 0x10000) & 0x3FF + 0xDC00) and offers the ES2015 \u{…} syntax when a single escape per code point is preferred.