100% local — your data never leaves your browser

Java Unescape — Read a Literal From Source

Decode a Java string literal back to text, including \uXXXX and surrogate pairs, so a line lifted out of a .java file becomes readable again.

Instant Private Zero cookies

Java Escaped input

Text output

What this tool does

It reads the contents of a Java string literal and returns the text they stand for. The named escapes \n, \r, \t, \b, \f and \0 become their characters, \uXXXX is decoded, and a surrogate pair written out as \ud83d\ude00 is recomposed into the one character it encodes — which is how any character above U+FFFF has to be written in a Java literal.

Because Java escapes every non-ASCII character on the way out, this is the step that makes an escaped literal readable again: a wall of é and 中 comes back as the accented and CJK text it stands for.

Where Java differs

Java’s set is smaller than JavaScript’s. There is no \v and no \a: both come back as the bare letter, v and a, rather than as a control character the language never had. Octal escapes, on the other hand, are fully decoded: \0 gives NUL, \101 gives A, and the three-digit form is accepted only when the first digit is 0 to 3, which is what the Java grammar itself says.

In the other direction the tool is more permissive than the compiler. \u{1F600} and \xNN are accepted because they show up constantly in text copied between languages, but neither is valid Java — javac rejects both.

What it does not do

It decodes one literal’s contents, not a Java expression: nothing is concatenated, and text blocks (""") have their own rules for incidental whitespace that this tool does not apply.

Private by design

Everything runs locally in your browser with JavaScript. Your data is never uploaded, which makes the tool safe for sensitive content, and it keeps working offline.

Frequently asked questions

Why does `\v` not give a vertical tab?
Because Java has no `\v`. Adding it would mean decoding something `javac` rejects outright, so the tool returns the bare letter `v` instead of inventing a control character.
Are `\u{...}` and `\xNN` valid Java?
No. They are accepted here because they turn up in text copied between languages, but `javac` would reject both. Only `\uXXXX` is real Java.
What about octal escapes?
Decoded, exactly as Java does it. `\101` gives `A` and `\012` a line feed. Three digits only when the first is 0 to 3 — Java's own rule — so `\400` is `\40` followed by the text `0`.

Related converters