What are Unicode and UTF-8?
Unicode assigns a number (a code point, written U+0627 for Arabic alef) to every character of every script; UTF-8 is the encoding that turns those numbers into one to four bytes and is the default on the web and in JSON. Most "garbled text" bugs are a UTF-8 byte sequence being read as another encoding, or a string counted in bytes where the program expected characters.
How to use Unicode Encoder
- Paste any text — Arabic, Devanagari, emoji, accents.
- Pick the notation your language or file format expects.
- Enable "Escape ASCII too" for fully escaped strings.
- 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\ude80Frequently 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.
References
- The Unicode StandardThe universal character set and its encoding forms (UTF-8, UTF-16, UTF-32), normalization and the properties of every code point.
- RFC 3629: UTF-8, a transformation format of ISO 10646How code points are encoded as one to four bytes in UTF-8, and which byte sequences are invalid.