FormatterHQ

Java String Unescape

Decode escaped Java string literals back to readable text, including Unicode escapes, octal escapes and the rarely seen multiple-u \uuuu0041 form.

Loading tool…
Ready.

How to use the Java Unescape

  1. Type or paste into the Escaped Java box, or click Sample. You can also drop a text file on either box, or load one into the Escaped Java box with its Open file button.
  2. The Raw text box updates live as you type. It works both ways — edit the Raw text side to convert back, or click ⇄ Swap to exchange the sides.
  3. Use Copy or Download on either box to take the result, or Clear to start again.

Java unescape: from source literal to text

The Java unescape tool reads escape sequences the way javac does and returns the actual characters. Use it to read strings copied from source code, stack traces, toString() output or .properties files, where accented letters often appear as \u00E9.

Supported Java escapes

SequenceMeaning
\n \r \t \b \fLine feed, carriage return, tab, backspace, form feed
\\ \" \'Backslash, double quote, single quote
\uXXXXUTF-16 code unit; pairs combine into emoji and other supplementary characters
\uuuu0041Same as \u0041 — Java allows any number of u’s
\0 to \377Octal escape for U+0000 to U+00FF (legacy C style)

Octal escapes follow the Java grammar: up to three digits when the first is 0–3 (\101 is “A”), otherwise up to two. Unrecognised sequences are kept verbatim so you can see them rather than silently losing data; a \u not followed by four hex digits is reported as an error.

Example

Input:

Jos\u00E9 said \"hi\"\n\tTab \101 \uuuu0042

Output:

José said "hi"
	Tab A B

Where the multiple-u form comes from

The Java Language Specification lets a Unicode escape have several u characters so that tools which convert non-ASCII source to ASCII (the old native2ascii utility) can mark escapes they added themselves. You will rarely write \uuu0041 by hand, but it does turn up in generated code, and this tool decodes it correctly.

Properties files and resource bundles

Before Java 9, .properties resource bundles were read as ISO-8859-1, so any other character had to be written as a Unicode escape — which is why so many translation files are full of \u00FC and \u4E2D. Java 9 switched resource bundles to UTF-8 (JEP 226) and removed the native2ascii tool, but the escaped files live on in older projects. Pasting their values here is the fastest way to check what a translator actually wrote.

Remember to paste only the value, not the whole line: the key and separator pass through unchanged, and a trailing backslash used for line continuation in properties files is not interpreted.

Need to go back? Java Escape produces a safe literal from plain text. For Kotlin or JavaScript sources, try JavaScript Unescape, whose rules include \x and \u{…}. All processing happens locally in your browser.

Frequently asked questions

Does it handle surrogate pairs?
Yes. Two consecutive escapes such as \uD83D\uDE80 are decoded to the single emoji they represent, exactly as a Java String would hold them.
Does Java support \x hex escapes?
No. Java has no \x escape; use \uXXXX instead. A \x sequence is left unchanged by this tool, and javac would reject it as an illegal escape.
Can I decode .properties files with this?
Yes, for the values. Properties files use the same \uXXXX escapes, so pasting a value decodes accented characters and symbols. Keys and the = separator pass through unchanged.
What about the \s escape from Java 15?
The \s (space) and line-continuation escapes were added for text blocks in Java 15. This tool focuses on classic string literal escapes and leaves \s as it is.
How do I unescape a Java string in code?
Apache Commons Text provides StringEscapeUtils.unescapeJava(), which handles \u escapes as well. Java 15 added String.translateEscapes(), but it deliberately skips Unicode escapes, because the compiler normally processes those before anything else. If your text contains \u00E9, the built-in method leaves it unchanged.
Why can a \u escape in a comment break Java code?
Unicode escapes are translated before the source is split into tokens, everywhere in the file. A comment such as // see C:\users fails to compile because \users is read as a malformed Unicode escape, and \u000a in a comment becomes a real line break that ends the comment early. Write a literal backslash-u in comments with a space or a different wording.

Last updated October 3, 2026

Related tools