Unicode Escape

Escape non-ASCII characters to \uXXXX, or restore \uXXXX / \xXX

Encode Decode
Chars: {{ inputText.length }}
HTML Entity →

About Unicode Escape

Unicode escape (written as \uXXXX) uses 4 hexadecimal digits to represent a character's code point. It is the standard way to express non-ASCII characters in JavaScript, Java, JSON and similar languages. Escaping Chinese and other characters to \uXXXX makes the text ASCII-only, so it can travel safely through ASCII-only channels and be restored at the destination.

When encoding, this tool keeps printable ASCII intact and escapes only the rest; when decoding, it supports both \uXXXX and \xXX forms while preserving literal text.

Examples

Input: Hello, World! → Output: Hello, World!

Reverse — Input: Hello, World! → Output: Hello, World!

FAQ

Q: What is the difference between \u and \x?
A: \uXXXX is a 4-digit hex code point (covers the whole Basic Multilingual Plane), while \xXX is 2-digit hex (only 0-255). This tool decodes both.
Q: Why aren't English letters escaped?
A: To keep results readable and compact, printable ASCII characters (letters, digits, punctuation) are kept as-is; only non-ASCII characters are escaped to \uXXXX.