LazyTools

🔒 Every tool runs in your browser, the files and values you enter are never uploaded to any server. How it works

🔤 Unicode Escape Converter

Turn accented letters, emoji and other non-ASCII characters into \uXXXX escapes, or paste \u escapes to get the readable text back.

3 non-ASCII characters escaped to \uXXXX

Rate this tool:
Anonymous, no account, no identifier

How the unicode escape converter works

Encoding replaces every character outside the basic ASCII range (code point above 127) with a \uXXXX escape, the four-hex-digit UTF-16 code unit used by JSON, JavaScript, Java and many config formats. Characters above the Basic Multilingual Plane (like most emoji) become a surrogate pair of two \u escapes. Decoding turns \uXXXX back into its character, and also understands the \u{...} form used in modern JavaScript and Rust.

ASCII characters (plain English letters, digits and common punctuation) are left untouched, only non-ASCII characters are escaped, which is what makes text safe for ASCII-only channels while staying readable. To escape absolutely everything, this isn’t the tool; it targets the common "keep it ASCII-safe" use case.

Frequently asked questions

What is a Unicode escape sequence?

A way of writing a character using its code point in hexadecimal, like \u00e9 for é. It lets you include any character in source code or data files that only safely handle ASCII.

How do I convert text to \u escapes?

Choose Encode and paste your text; every non-ASCII character becomes a \uXXXX sequence. For example café becomes caf\u00e9. Plain ASCII characters are left as-is.

Why does an emoji become two \u escapes?

Characters above U+FFFF (including most emoji) are stored as a UTF-16 surrogate pair, so they encode as two \uXXXX units. Decoding the pair together reproduces the original emoji.

Does it support the \u{...} form?

For decoding, yes, the tool understands both the fixed four-digit \uXXXX form and the braced \u{1F600} form used in modern JavaScript and Rust. Encoding produces the widely compatible \uXXXX form.

How does a surrogate pair work, with an example?

A character above U+FFFF is split into two 16-bit halves: a high surrogate in the range D800-DBFF and a low surrogate in DC00-DFFF. The emoji 😀 (U+1F600) encodes as \ud83d\ude00. Decoded together, the pair reconstructs the single code point; a lone half is an invalid, incomplete escape.

What is the difference between \uXXXX and \u{...}?

The classic \uXXXX form is always four hex digits and can only reach U+FFFF directly, needing a surrogate pair beyond that. The braced \u{...} form (ES6 and Rust) takes one to six hex digits, so \u{1F600} names an emoji in a single escape. This tool decodes both and encodes to the compatible \uXXXX form.

Is this the same as URL or HTML encoding?

No. URL encoding uses %XX bytes and HTML uses &#...; entities. \uXXXX is the escape used inside string literals in JSON, JavaScript, Java and similar languages, use the matching tool for each context.

Does it escape plain ASCII characters?

No, only characters with a code point above 127 (non-ASCII) are turned into \uXXXX escapes. Ordinary English letters, digits and common punctuation are left exactly as they are, which is what keeps the result readable while making it safe for ASCII-only channels.

What is a code point?

A code point is the numeric identity Unicode assigns each character, usually written as U+ and hex, é is U+00E9 and 😀 is U+1F600. A \uXXXX escape simply writes that number in hexadecimal, so \u00e9 and U+00E9 refer to the same character.

Related developer tools