Java String Escape / Unescape
Paste any text into Java source safely — quotes, backslashes, newlines and unicode handled.
About this tool
File paths on Windows, JSON blobs, regex patterns — plenty of text contains characters that mean
something else inside a Java string literal. This tool escapes everything the compiler would
trip over: backslashes, double quotes, newlines, tabs and control characters (as
\uXXXX), so the result can be pasted between quotes in Java source directly.
How to use it
- Paste the raw text, or click Sample (a Windows path plus quotes and tabs).
- Click Escape ▸ to prepare it for Java source, or paste escaped text and click ◂ Unescape to get the original back.
Good to know
- Unescaping understands
\n,\r,\t,\b,\f, octal escapes and\uXXXX. - Output does not include the surrounding quotes — add them in your editor.
- The same escapes apply to Kotlin, Groovy and other Java-string-compatible contexts.