Unicode Escape Converter
Convert text to \uXXXX Unicode escape sequences and back. Encode any characters for code and JSON, or decode escaped strings to plain text.
Calculator by Toolsloft ↗Convert text to \uXXXX Unicode escape sequences and back. Encoding turns each character into the escape form used in JavaScript, JSON, and many config files, and decoding turns those escapes back into readable text. Useful for pasting non-ASCII characters into code or reading escaped strings from logs.
How this is calculated
Encoding walks the string one UTF-16 code unit at a time and writes each as a four-digit lowercase hex escape, so characters above U+FFFF are written as a surrogate pair, exactly as JavaScript stores them. Decoding replaces every \uXXXX match with the character for that code unit and leaves other text unchanged.
How to use
- Choose encode to turn text into \uXXXX escapes, or decode to turn escapes into text.
- Type or paste your text in the input box.
- Copy the converted result from the output box.
Examples
- Encode:
AB becomes \u0041\u0042 - Decode:
caf\u00e9 becomes café
FAQ
- What is a \uXXXX escape?
- It is a way to write a character using its Unicode code unit in hexadecimal, such as \u00e9 for é. JavaScript, JSON, Java, and many other formats accept this notation inside strings.
- How are emoji and other characters above U+FFFF handled?
- Characters beyond U+FFFF are stored as two UTF-16 code units, called a surrogate pair, so encoding writes two \uXXXX escapes. Decoding those two escapes together rebuilds the original character.
- What happens to characters that are already plain ASCII when decoding?
- Only text that matches the \uXXXX pattern is converted. Any other characters, including regular letters and punctuation, are passed through unchanged.