RUNWEBTOOLS
English

Unicode Encode / Decode

Convert text to and from Unicode escape sequences.

Format

Use on any page (bookmarklet)

Want Unicode Encode / Decode without leaving the page you're on? Drag the button below to your bookmarks bar, then click it on any website to open Unicode Encode / Decode right there — it runs entirely in your browser.

Unicode Encode / Decode← drag this to your bookmarks bar

Use responsibly: a bookmarklet runs on whatever page you click it on. Avoid sensitive sites such as online banking, payment, or healthcare pages — you run it at your own risk. Everything is processed locally and no data is sent anywhere. See our Terms.

  1. Show your bookmarks bar if it's hidden — Ctrl+Shift+B (+Shift+B on Mac).
  2. Drag the button above onto the bookmarks bar.
  3. Open any website and click the bookmark — the Unicode Encode / Decode panel appears in the top-right corner. Use ✛ to move it between corners, or ›/‹ to tuck it against the edge and pull it back out.
  4. Click the bookmark again (or the ✕) to close it.
Can't drag? Copy it and create a new bookmark with this as the URL:

Note: a few sites with strict security policies may block bookmarklets.

Examples

Encode to \u escapes

Input

Hi 世界

Output

\u0048\u0069\u0020\u4e16\u754c

Decode code points

Input

U+1F44B U+0041

Output

👋 A

About this tool

This free online Unicode converter turns text into escape sequences and back. Pick JavaScript \uXXXX, code-point U+XXXX, or HTML &#xXXXX; output when encoding, and decode any of those formats — including \u{...} and decimal entities — back to plain text. Emoji and other astral characters are handled correctly. Everything runs in your browser with no upload.

How to use

  1. Choose Encode or Decode.
  2. When encoding, pick the output format.
  3. Type or paste your text (or click Sample to try it).
  4. Copy the result, or use Swap to convert it back.

Three answers to “how long is this string?”

Unicode has three units, and most bugs in text handling come from mixing them up:

  • Code unit — what JavaScript, Java, and Windows count. Anything above U+FFFF takes two, so "😀".length is 2.
  • Code point — one entry in the Unicode table. 😀 is a single code point.
  • Grapheme — what a reader calls one character. The family emoji 👨‍👩‍👧 is five code points (three people joined by two zero-width joiners) but one grapheme.

This is why slicing a string at an arbitrary index can produce a replacement box: the cut landed between the two halves of a surrogate pair. It is also why a “280 character” limit counts differently depending on which unit the platform chose.

Finding the character you can't see

The most practical use of this tool is identifying an invisible troublemaker. Encoding a suspect string reveals exactly what is in it, and the usual suspects are recognisable on sight once you know their code points:

  • U+00A0 — non-breaking space. Arrives with anything copied from a web page and defeats trimming and matching.
  • U+200B — zero-width space. Invisible, but breaks string comparison and search.
  • U+FEFF — byte-order mark. Turns up at the start of files and can break the first line of a CSV or JSON parse.
  • U+2018U+201D — smart quotes, substituted automatically by word processors and invalid in most code.

Once identified, strip or swap them with find and replace.

Common uses

Embedding non-Latin text in source code that must stay ASCII-only, debugging encoding problems where text arrives as mojibake, identifying invisible or look-alike characters in data, and preparing strings for JSON, CSS content, or HTML. For escaping text destined for markup specifically, the HTML entity encoder is the more direct tool.

Frequently asked questions

What does this Unicode converter do?

It converts text into Unicode escape sequences and back. Encode 'A' to \u0041, U+0041, or A, and decode any of those forms back to readable text.

Why does one emoji count as two characters?

Because JavaScript, Java, and Windows all measure strings in UTF-16 code units, and any character above U+FFFF is stored as a surrogate pair — two units for one symbol. That is why 😀 reports a length of 2, and why naive string slicing can cut an emoji in half and produce a replacement box. Counting by code point, or better by grapheme, gives the number a person would expect.

What's the difference between a code point and a grapheme?

A code point is one entry in the Unicode table; a grapheme is what a reader sees as a single character, and it can be built from several code points. The family emoji 👨‍👩‍👧 is three people joined by zero-width joiners — five code points, one grapheme. An accented é may be one code point or two (e plus a combining acute) depending on how it was typed. This is why 'string length' has at least three defensible answers.

Which formats are supported?

Encoding offers JavaScript \uXXXX, code-point U+XXXX, and HTML &#xXXXX; output. Decoding accepts all of those plus \u{...} and decimal &#NNN; entities.

Does it handle emoji and astral characters?

Yes. Characters above U+FFFF, like emoji, are encoded using \u{...} in JavaScript mode and a full code point in U+ mode, and decode back correctly.

Is my text uploaded anywhere?

No. Conversion runs entirely in your browser with no upload, so your text never leaves your device.

Why are escape sequences useful?

They let you embed any character in source code, JSON, or HTML using only ASCII — handy for non-Latin text, invisible characters, and avoiding encoding issues.

Learn more

Related tools