NathanTools

Unicode Encode & Decode

Turn any text into Unicode escape sequences for JavaScript, JSON, Python or CSS, or decode escapes back into characters and inspect each code point.

100% free No sign-up Works on any device

Report a bug

Unicode Encode / Decode

Input

Output

Converts as you type. Nothing leaves your browser. Ctrl + Enter copies the result.

Updated November 2026 · Unicode 16 aware · Runs in your browser

How to convert text to Unicode escapes

  1. Paste your text into the Input box, or press Sample.
  2. Pick the format your language or file needs: \uXXXX for JavaScript, Java and JSON, \u{…} for modern JavaScript, CSS for content: values, UTF-8 bytes for C, Python byte strings and debugging, or HTML for web pages.
  3. Choose Decode to turn any mix of escapes back into readable text.
  4. The Character inspector lists every character with its code point, UTF-8 bytes and UTF-16 units, which is handy for finding invisible characters.

Unicode escape formats by language

The same character, 😀 (U+1F600), written in each format:

WhereFormat😀 written as
JavaScript, JSON, Java, C#\uXXXX (UTF-16)😀
JavaScript (ES6+), Swift, Rust\u{X}\u{1F600}
Python, C, C++\UXXXXXXXX\U0001F600
CSS content\X\1F600
HTML&#…; or &#x…;😀
UTF-8 bytes (C, Python bytes, logs)\xHH\xF0\x9F\x98\x80
URLs%HH%F0%9F%98%80 (use the URL encoder)
Unicode charts and docsU+XU+1F600

Code points, UTF-8 and UTF-16

Unicode gives each character a number called a code point, written U+ followed by hex. There are room for 1,114,112 code points, and Unicode 16.0 (2024) assigns more than 154,000 characters. An encoding decides how those numbers are stored as bytes:

CharacterCode pointUTF-8UTF-16
AU+004141 (1 byte)0041
éU+00E9C3 A9 (2 bytes)00E9
€U+20ACE2 82 AC (3 bytes)20AC
你U+4F60E4 BD A0 (3 bytes)4F60
😀U+1F600F0 9F 98 80 (4 bytes)D83D DE00 (surrogate pair)

UTF-8 is used by about 98% of websites because plain English text stays one byte per character and it's compatible with ASCII. UTF-16 is used inside JavaScript, Java, C# and Windows, which is why string lengths count an emoji as 2.

Finding hidden characters

Text copied from the web or word processors can carry invisible characters that break code, passwords and CSV imports. Paste it here and check the inspector for these culprits:

  • U+00A0 non-breaking space, which looks like a space but doesn't match one.
  • U+200B zero-width space and U+200D zero-width joiner.
  • U+FEFF byte order mark at the start of a file.
  • U+2018/U+2019 and U+201C/U+201D curly quotes in place of straight quotes in code.

Frequently asked questions

A way of writing a character with plain ASCII so it survives in source code, JSON or config files. In JavaScript, Java and JSON, é is written \u00e9: a backslash, a u and the character's four-digit hexadecimal code. The program turns it back into é when it reads the text.

JavaScript, Java, C# and JSON store text as UTF-16, which uses 16-bit units. Characters above U+FFFF, including most emoji, need two units called a surrogate pair. 👋 (U+1F44B) becomes \ud83d\udc4b. ES6 JavaScript also accepts \u{1F44B}, which this tool produces in the \u{…} mode.

Unicode is the list that gives every character a number, its code point (é is U+00E9). UTF-8, UTF-16 and UTF-32 are encodings: ways to store those numbers as bytes. UTF-8 uses one to four bytes per character and is the standard for the web; é takes two bytes, C3 A9.

Paste the text and choose Decode. It understands \uXXXX, \u{…}, Python's \UXXXXXXXX, UTF-8 byte escapes (\xE2\x82\xAC), U+ code points and HTML numeric entities, and leaves the rest of the text unchanged.

That's mojibake: UTF-8 bytes were read as Windows-1252 or Latin-1. é is stored as the bytes C3 A9, which display as é in the wrong encoding. Fix it by declaring UTF-8 (for example <meta charset="utf-8"> or the database connection's charset) rather than by editing the text.

No. Conversion happens in your browser, and nothing is sent to our server.

Comments

No comments yet.

Share this tool

Unicode Encode / Decode

Favorites

Drag to reorder, or use the arrows. Categories and the tools inside them can both be moved.

Saved in this browser. Sign in to keep them on every device.

Esc
↑ ↓ to moveEnter to open