Convert text to Unicode escapes

Convert text to Unicode escape sequences in your browser β€” \uXXXX for JS and JSON, \u{...} for ES6, \UXXXXXXXX, compact \xXX. Printable ASCII can stay readable.

Paste text and get its escape-sequence form in the dialect you need: lowercase \uXXXX for JavaScript string literals and JSON, uppercase \uXXXX for Java .properties files, \UXXXXXXXX (8 hex digits) for Python and C++11 sources, \u{...} for ES6 and Rust, or compact \xXX + \uXXXX.

Keep printable ASCII readable (the default) and only characters outside it get escaped β€” the output stays legible with just the troublesome characters armoured. Untick it to escape everything, which is what you want when a file format refuses non-ASCII bytes outright.

Characters above the Basic Multilingual Plane (emoji, rare hanzi) are emitted as surrogate pairs where the target syntax needs them (\uXXXX and \xXX styles) and as single escapes where it doesn't (\u{} and \U) β€” each form decodes back to the same character. Conversion runs locally in your browser.

Frequently asked questions

Which escape style is which?
\uXXXX lowercase is JavaScript/JSON; uppercase \uXXXX is Java properties; \UXXXXXXXX is Python and C++11; \u{...} is ES6, Rust and Swift; \xXX is the compact Latin-1-friendly form. The decode page understands all of them plus HTML numeric references.
Why does emoji become two escapes in some styles?
\uXXXX and \xXX can only express 16 bits, so an astral character (like πŸŽ‰) is written as its surrogate pair β€” two escapes that every JS and JSON parser joins back into one character. \u{} and \U express the full code point in one escape.
Does the output stay valid JSON?
Yes β€” the lowercase \uXXXX style with ASCII kept readable produces strings you can paste straight into JSON, which is how people smuggle non-ASCII through systems that mangle encoding.