Java Unescape

Unescape Java strings back to plain text.

Local Your input is processed locally in your browser. Found a problem? Report an issue

What Java Unescape does

Java Unescape decodes the escape sequences that the Java language defines: \b \t \n \f \r, \s (a space, Java 15 and later), the escaped quotes and backslash, octal escapes from \0 to \377, and Unicode escapes, which Java allows with any number of u letters (\uuu0041).

A backslash followed by anything else is a compile error in Java, so the tool reports it with its line and column instead of guessing what was meant.

Java Unescape examples

The built-in sample

Input

say \"hello\" & <b>bye</b>

Output

say "hello" & <b>bye</b>

This is the input that the Load sample button fills in.

Unicode, octal and \s

Input

Zo\u00EB\s\101\s\uD83D\uDE00\n\"done\"

Output

Zoë A 😀
"done"

\u00EB is ë, \101 is A in octal, \s is a space, and the surrogate pair becomes one emoji.

An escape Java does not allow

Input

C:\data\new

Result

\d is not a Java escape. Java allows \b \t \n \f \r \s \" \' \\, octal \0 to \377 and \uXXXX (line 1, column 3)

\d is not a Java escape. Escape the backslash: C:\\data\\new.

Each output was produced by running this tool on the input above it.

How it works

Each backslash sequence is replaced as shown below.

Escaped formCharacter
\b \t \n \f \rthe control characters
\sspace
\" \' \\" ' \
\0 to \377octal character code
\uXXXX, \uuXXXXUTF-16 code unit
backslash + line breaknothing (text block line continuation)

Details and limits

  • The Java compiler translates \u escapes before it reads the code, so \u000A in a source file is a real line break that can break the code. This tool decodes them as text, which is what you want when reading a string value.

Questions

Is my data uploaded when I use Java Unescape?

No. The tool runs in your browser, so what you paste or open is processed on your own device and is not sent to a server.

What does Java Unescape do?

Java Unescape decodes the escape sequences that the Java language defines: \b \t \n \f \r, \s (a space, Java 15 and later), the escaped quotes and backslash, octal escapes from \0 to \377, and Unicode escapes, which Java allows with any number of u letters (\uuu0041).

Are there any limits I should know about?

The Java compiler translates \u escapes before it reads the code, so \u000A in a source file is a real line break that can break the code. This tool decodes them as text, which is what you want when reading a string value.

Is there a size limit?

There is no fixed size limit. Everything happens on your device, so very large inputs depend on its memory and can take longer on a phone than on a computer.

Does it work on phones, and is it free?

Yes. It works in any current browser on Android phones, iPhones, tablets and computers. It is free and needs no account or sign-up.