Unicode \uXXXX String Escaper

Escape text to \uXXXX, \u{X}, and \xXX sequences for JavaScript, JSON, Python, or CSS online for free, or unescape hex escapes back to readable Unicode.

No uploadsNo sign-upInstant results
\u{1f600} \ud83d\ude00JS · JSON · Python · CSS100% Local • Zero Uploads
Escape / Unescape Unicode
Offline engine ready100% private in-browser workspace • Zero cloud uploads
100% Private • Zero Server File Uploads

Why Use Utiliome's Free Unicode \uXXXX String Escaper?

Built from the ground up for strict privacy, instant execution, and zero friction. No subscriptions, paywalls, or account registrations required.

Escape Formats for JavaScript, JSON, Python and CSS

Supports ES6 \u{XXXX}, JSON/Java UTF-16 \uXXXX, Python \xXX / \uXXXX / \UXXXXXXXX, CSS \XXXX , and \xXX UTF-8 byte escapes, for encoding and decoding.

Escape Only Non-ASCII or Every Character

Keep ASCII source code readable while escaping international characters, or escape all characters for strict environments.

Multi-Language Escape Syntax (JS, JSON, Python, CSS & Rust)

Switch between standard 4-digit \uXXXX (JSON/JS), braced ES6/Rust \u{XXXXX}, Python 8-digit \UXXXXXXXX, Hex \xXX, and CSS \XXXXX escapes.

Correct UTF-16 Surrogate Pair vs ES6 Code Point Escaping

Automatically emits valid surrogate pairs (\uD83D\uDE80) for strict RFC 8259 JSON compatibility or compact \u{1F680} for modern ES6+, Rust, and Swift.

Utiliome vs Traditional Cloud Alternatives

Compare our local-first WebAssembly engine against legacy cloud tools.

Feature Utiliome (Local Browser) Legacy Cloud Converters
Programming Language Syntaxes Supports JS/JSON (\uXXXX), ES6/Rust (\u{X}), Python (\UXXXXXXXX), CSS (\XXXX ) & \xXX Outputs 4-digit \uXXXX only, which cannot represent astral emojis in CSS or Python
Strict JSON Surrogate Pair Compliance Encodes emojis as valid \uD83D\uDE80 in JSON mode (since JSON forbids \u{1F680}) Emits \u{1F680} or truncates 5-digit hex, causing JSON.parse() syntax errors
ASCII Preservation Toggle Escape non-ASCII characters only (keeping code readable) or escape every character Escapes every ASCII letter into unreadable \u0061\u0062\u0063 blocks
100% Client-Side Execution Escapes and unescapes strings locally in browser RAM with zero server calls Sends source code literals and localization strings to backend servers
How it works

How to Use Unicode \uXXXX String Escaper in 3 Easy Steps

No software installation required. Everything runs directly inside your web browser.

1

Input Source Code or Text

Paste text or code containing international characters, symbols, or escape sequences.

2

Choose Target Language Format

Select ES6, JSON/Java UTF-16, Python 32-bit, CSS, or \xXX hex escapes and toggle ASCII-safe mode.

3

Copy Escaped Source Code

Copy the escaped strings into your JavaScript, Python, CSS, or Java properties files.

Unicode Escapes in JavaScript, JSON, Python and CSS

Quick Answer: Utiliome converts Unicode text into ASCII-safe source-code escape sequences—including 4-digit \uXXXX (with automatic UTF-16 surrogate pairs for RFC 8259 JSON), braced ES6/Rust \u{XXXXX}, Python \UXXXXXXXX, hexadecimal \xXX, and CSS \XXXX—and unescapes any of them back to readable text. All computation executes 100% locally in your browser with zero server uploads.

Different programming environments enforce distinct escape syntaxes for representing non-ASCII characters. This tool formats text across all major language conventions:

Given this JavaScript configuration snippet containing an emoji and accented character:

const label = "Café 🚀";

Formatting across language modes produces:

ES6 (\u{...}):          const label = "Caf\u{e9} \u{1f680}";
JSON / Java (\uXXXX):   const label = "Caf\u00e9 \ud83d\ude80";
Python (\x \u \U):      const label = "Caf\xe9 \U0001f680";
CSS (\XXXX ):           const label = "Caf\e9  \1f680 ";
UTF-8 bytes (\xXX):     const label = "Caf\xc3\xa9 \xf0\x9f\x9a\x80";

Notice that in JSON/Java mode, the rocket emoji decomposes into two UTF-16 surrogate pairs (\ud83d\ude80), while ES6 and Python use clean single-token representations. Python writes characters below U+0100 as \xe9, the way its own ascii() does. Every CSS escape ends with a terminating space, so the real space after é shows up as two spaces. The UTF-8 byte mode writes the bytes of each character, which is what C strings and shell printf expect.

Which Escape Syntax Each Language Accepts

Quick Answer: By keeping printable 7-bit ASCII characters (0x20–0x7E) readable by default while escaping all non-ASCII code points above U+007F, you can safely embed international localization strings, symbols, and emojis inside ASCII-only source files and JSON payloads. All computation executes 100% locally in your browser with zero server uploads.

Review the technical specifications for each escape syntax:

  • ES6 Variable-Width (\u{...}): Modern ECMAScript (ES2015+) supports variable-width curly brace notation, allowing astral code points like \u{1F680} without manual surrogate splitting.
  • Java & JSON UTF-16 (\uXXXX): Requires fixed 4-digit hex codes. Characters above U+FFFF must be represented as high (\uD800-\uDBFF) and low (\uDC00-\uDFFF) surrogate pairs.
  • Python (\xhh, \uhhhh, \Uhhhhhhhh): Python requires an uppercase \U followed by exactly 8 hexadecimal digits for code points above U+FFFF; this tool mirrors Python's ascii() output, using \xhh below U+0100 and \uhhhh for the rest of the BMP.
  • CSS (\hhhhhh ): One to six hex digits terminated by a space, so a digit that follows is not swallowed.
  • UTF-8 bytes (\xhh): Each character as its UTF-8 bytes; decoding reads the bytes back as UTF-8.
  • Bidirectional decoding: Pick the syntax your input uses and the decoder converts it back to text. The JavaScript, JSON and Python syntaxes are decoded together because they do not conflict; CSS and UTF-8 byte escapes have their own modes. An escaped backslash (\\u0041) is left untouched.

To inspect code points and UTF-8 bytes, use Unicode Converter.

Unicode Escape Tool vs Unicode Converter: Which One Do You Need?

Quick Answer: Use this Unicode \uXXXX String Escaper when embedding or decoding backslash escape sequences in JavaScript, JSON, Python, Rust, or CSS source code; use Unicode Code Point Converter to inspect U+XXXX and UTF-8 bytes, or HTML Entity Encoder for HTML/XML markup.

The two tools look similar but serve different jobs:

Unicode Escape Tool (this page) Unicode Converter
Purpose Write string literals for code Inspect and debug text
Output notation Language escape syntax such as \u00e9, \u{1F680}, \U0001F680 U+XXXX, decimal, UTF-8 hex bytes, per-character table
Typical question "How do I put this emoji in a JSON or JavaScript string?" "Which invisible character is in this string?"

If you need to paste a character into source code without encoding problems, start here. If you need to find a stray zero-width space or confirm the bytes a database will store, use the Converter.

Why RFC 8259 JSON Rejects \u{1F680} and Requires \uD83D\uDE80 Surrogate Pairs

Quick Answer: While ECMAScript 2015 (ES6) introduced variable-length braced escapes (\u{1F680}) for JavaScript source files, the RFC 8259 JSON grammar strictly permits only fixed 4-hex-digit \uXXXX escapes, requiring supplementary code points (U+10000+) to be written as two consecutive UTF-16 surrogate escapes. All computation executes 100% locally in your browser with zero server uploads.

One of the most common production bugs in API localization and string serialization is mixing ES6 JavaScript string escapes with strict JSON escapes:

  1. Strict JSON (RFC 8259 Section 7): In JSON, "\u{1F680}" is a fatal SyntaxError. Any character outside the Basic Multilingual Plane (U+0000–U+FFFF) must be encoded as its 12-character UTF-16 surrogate pair: "\uD83D\uDE80".
  2. ES6+ JavaScript, TypeScript & Rust (\u{1F680}): Inside .js, .ts, and .rs string literals, braced code-point escapes are cleaner and represent the true 21-bit scalar value directly.
  3. CSS Content Property (content: "\1F680"): CSS uses a single backslash followed by up to 6 hexadecimal digits (terminated by a space if the next character is a valid hex digit 0–9a–f).

Explore related escaping and inspection tools: Unicode Code Point Converter, Invisible Character Inspector, HTML Entity Encoder, and JSON Formatter.

FAQ

Unicode \uXXXX String Escaper FAQ and Technical Guide

Everything you need to know about using Utiliome's free online unicode escape tool.

Why does JSON and Java require two \u codes for a single emoji?

JSON and Java specifications use 16-bit UTF-16 escape sequences (\uXXXX). Characters above U+FFFF cannot fit into 4 hex digits and must be split into a high and low surrogate pair.

What is the advantage of ES6 \u{1F600} notation over surrogate pairs?

ES6 curly-brace notation represents the true Unicode code point directly in one token, making code easier to read and debug than split surrogate pairs.

Why does an emoji become two \u escapes in JSON and JavaScript?

JSON and classic JavaScript escapes are limited to 16-bit values, and most emoji sit above U+FFFF. They are therefore written as a surrogate pair, two \u escapes such as \uD83D\uDE80 for the rocket. Modern JavaScript also accepts the single code point form \u{1F680}, and Python uses \U0001F680.

Are Unicode escapes the same as HTML entities?

No. Escapes such as \u00e9 belong inside string literals in programming languages and data formats like JSON. HTML uses entities such as é or é instead. Use the HTML Entity Encoder for web pages and this tool for code.

Why does CSS unicode escaping sometimes add a space after "\XXXX"?

In CSS syntax (CSS Syntax Module Level 3), a backslash escape consumes 1 to 6 hexadecimal digits. If the character immediately following the escape happens to be a hex letter (a–f, A–F, or 0–9), CSS requires a single trailing space delimiter (which the CSS parser consumes and does not render) so it is not merged into the hex number.

Can the Unescape mode decode strings that mix "\uXXXX", "\u{XXXXX}", and "\xXX" together?

Yes! In Unescape mode, our parser automatically recognizes UTF-16 surrogate pairs (\uD83D\uDE80), standard 4-digit \uXXXX, braced \u{...}, 8-digit \UXXXXXXXX, and 2-digit \xXX sequences in the same string.