Skip to main content
Tools

Unicode Escape

Convert text to \uXXXX, \u{…}, &#x…;, U+XXXX and other escapes or back, with each character’s code point and UTF-8 bytes.

Characters to escape

0 characters · 1 line

0 characters · 1 line

Code points

Enter some text to list the code point and encodings of each character.

How to use

  1. Choose “Escape” to turn text into escape sequences, or “Unescape” to turn escapes back into text.
  2. When escaping, pick a format (JavaScript, ES6, Python, CSS, HTML or U+) and whether to escape only non-ASCII characters or everything.
  3. When unescaping, Auto recognizes \uXXXX, \u{…}, \UXXXXXXXX, \xXX, &#x…;, &#…; and U+XXXX together. Switch to CSS mode for CSS escapes.
  4. The “Code points” table lists each character’s code point, UTF-8 bytes, UTF-16 units and Unicode category.
  5. Click “Copy” to grab the result, or “Use result as input” to convert it back and check that it matches.

FAQ

Is my data uploaded?

No. Every conversion happens in your browser, and your data never leaves your device.

Why does one emoji become two \u escapes?

JavaScript, JSON and Java strings use UTF-16, and \uXXXX only reaches U+FFFF. Characters beyond that, such as emoji, are split into a surrogate pair: 👍 (U+1F44D) becomes \uD83D\uDC4D. ES6 \u{1F44D} and Python \U0001F44D write the full code point instead.

Where is each format used?

\uXXXX is for JavaScript, JSON, Java and C#; \u{…} for JavaScript since ES2015; \U for Python and C; \XXXX for CSS content values and selectors; &#x…; and &#…; for HTML and XML. U+XXXX is the Unicode standard’s notation, common in documentation.

Why do CSS escapes sometimes end with a space?

A CSS escape is a backslash and 1–6 hex digits, ending at the first character that is not a hex digit. When the next character happens to be 0–9 or a–f, a space separates them. CSS swallows that space, so it never shows up on the page.

Why does one visible character take several rows in the table?

Some characters are made of several code points: 👍🏽 is 👍 plus a skin tone modifier, é can be e plus a combining accent, and family emoji join people with a zero-width joiner (U+200D). The table lists every code point, which also helps you spot invisible characters.

Keyboard shortcuts

/
Search tools (on a tool page, goes to the homepage search)
?
Show this help
Esc
Close a dialog
Ctrl / ⌘Enter
Run the tool's main action (where supported)

While you type in a text field, / and ? are typed as usual.