Unicode Escape / Unescape Online

Escape text to \uXXXX, \xXX, or \u{...} sequences and unescape them back, entirely in your browser.

Unicode Escape / Unescape runs entirely in your browser. The text you type or paste is never uploaded and stays on your device.

Built and maintained by Udit Agarwal

Open the HTML Entities Encoder / Decoder

About Unicode Escape / Unescape

Unicode Escape / Unescape converts text into \uXXXX, \xXX, or \u{...} escape sequences and decodes those sequences straight back into readable characters. Pick a format — JavaScript, JSON, CSS, or Python — and the tool builds the matching escape syntax for every non-ASCII character, from accented letters to emoji, including proper surrogate-pair handling for astral codepoints above U+FFFF. Toggle "Only non-ASCII" to leave plain ASCII text untouched, or escape everything for a fully sanitized string. Switch to Unescape to paste escaped text — mixed \uXXXX, \u{...}, \xXX, and \UXXXXXXXX sequences all decode correctly. Useful for debugging encoding issues, sanitizing strings in source code, or preparing JSON payloads. Everything runs locally — nothing is uploaded.

Features

  • Escape text to \uXXXX, \u{...}, \xXX, or \UXXXXXXXX sequences depending on the selected format
  • JS, JSON, CSS, and Python escape formats, each matching that language's real syntax
  • Correct surrogate-pair output for astral characters like emoji in JSON and JS modes
  • "Only non-ASCII" toggle leaves plain letters, digits, and punctuation untouched
  • Unescape decodes \uXXXX, \u{...}, \xXX, \UXXXXXXXX, and CSS \XXXXXX sequences back to text
  • Handles mixed escape styles in a single pasted string
  • One-click copy of the escaped or decoded result
  • Runs entirely in your browser — no text is ever uploaded

How to use the Unicode Escape / Unescape

  1. Keep the Escape mode selected and pick a format: JS, JSON, CSS, or Python
  2. Type or paste the text you want to escape into the left pane
  3. Toggle "Only non-ASCII" on or off depending on whether plain characters should stay as-is
  4. Copy the escaped result, or switch to Unescape and paste escape sequences to decode them back

Example

Input

Héllo → ☃

Output

H\u00e9llo \u2192 \u2603

Non-ASCII characters become \uXXXX escapes; plain ASCII letters and spaces are left as-is.

Common errors & troubleshooting

  • Unescape leaves a \U escape sequence untouched. — \UXXXXXXXX requires exactly eight hex digits (Python's astral escape). Check the sequence has all eight characters after \U.
  • An emoji escapes to two separate \uXXXX codes in JSON mode instead of one \u{...} code. — That is expected — JSON has no \u{...} syntax, so astral characters are represented as a UTF-16 surrogate pair. Switch to JS format for a single \u{...} escape.
  • CSS escape output does not match what a stylesheet tool expects. — The CSS format here emits a fixed six-digit \XXXXXX escape. Some CSS tooling trims leading zeros or expects a trailing space before the next character — adjust as needed for your stylesheet.
  • Escaping with "Only non-ASCII" off produces a much longer string than expected. — That toggle controls whether plain ASCII letters, digits, and punctuation are escaped too. Turn it back on to only escape non-ASCII characters.

Frequently asked questions

What does the Unicode Escape / Unescape tool actually convert?
It converts any text into \uXXXX, \xXX, \u{...}, or \UXXXXXXXX escape sequences (depending on the format you pick) and can decode those sequences back into the original characters.
Which escape formats does Unicode Escape / Unescape support?
JS (\uXXXX and \u{...} for astral characters), JSON (\uXXXX surrogate pairs), CSS (\XXXXXX), and Python (\uXXXX and \UXXXXXXXX for astral characters).
How does Unicode Escape / Unescape handle emoji and other characters above U+FFFF?
It correctly detects astral codepoints and represents them using the target format's own syntax — a single \u{...} escape in JS, a surrogate pair of two \uXXXX escapes in JSON, or \UXXXXXXXX in Python.
What does the "Only non-ASCII" toggle do in Unicode Escape / Unescape?
When it is on (the default), plain ASCII characters such as letters, digits, spaces, and common punctuation are left exactly as typed, and only non-ASCII characters are escaped. Turn it off to escape every character.
Can Unicode Escape / Unescape decode mixed escape styles in one string?
Yes. The Unescape mode recognizes \uXXXX, \u{...}, \xXX, \UXXXXXXXX, and CSS \XXXXXX sequences and decodes any combination of them found in the pasted text.
Does Unicode Escape / Unescape upload the text I paste?
No. All escaping and decoding happens locally in your browser. Nothing you type or paste is sent anywhere.

Related tools

Guides

More Encode / Decode tools

  • Hex Dump Viewer — View text or a file as a classic hex + ASCII dump, with adjustable width.
  • Nano ID Generator — Generate URL-safe, collision-resistant Nano IDs with a custom size and alphabet.
  • Vigenère Cipher — Encode and decode Vigenère, autokey and Beaufort ciphers, with key-length hints.
  • QR Code Reader — Scan a QR code from an image, a screenshot or your camera and see what is inside — links, Wi-Fi, contacts and payments.
  • QR Code with Logo — Put your logo in a QR code and restyle its colours, shapes and frame, with a live check that it still scans.
  • UPI QR Code Generator — Make a UPI payment QR code from a UPI ID with an optional amount and note, and print a Scan to pay card.
  • vCard QR Code Generator — Turn contact details into a QR code phones can save in a tap, as vCard 3.0, 4.0 or MECARD, with a .vcf download.
  • WhatsApp QR Code Generator — Create a wa.me chat link and QR code from a phone number and an optional first message.
  • Bulk QR Code Generator — Turn a list or a CSV into up to 500 QR codes as a ZIP of PNG or SVG files, or a printable labelled sheet.
  • Unzip Files Online — Open a ZIP archive in your browser, preview files and extract one or all of them without uploading anything.
  • Base64 Encode / Decode — UTF-8 safe Base64 encoding and decoding.
  • URL Encode / Decode — Encode and decode URL components.

See all Encode / Decode tools (31) · All tools