Java String Escape
Escape text for a Java string literal (quotes, backslashes, newlines, \uXXXX) or unescape a Java string back to plain text. Free online Java escaper.
Runs in your browser. Nothing is uploaded.
About Java String Escape
Java string literals need backslashes, double quotes and control characters escaped. This tool converts any text into a literal you can paste between double quotes in Java (or Kotlin), with an option to write every non-ASCII character as a \uXXXX escape for source files that must stay ASCII.
Unescape reverses it, including octal escapes and \u sequences, so you can read strings copied out of Java source, stack traces or properties files.
How to use Java String Escape
- Type or paste your text into the input box. Press Sample to see an example.
- Adjust the options. The result updates as you type.
- Copy the result, or press Use as input to chain another transformation.
Frequently asked questions
What about Java text blocks?
Text blocks (""") need far fewer escapes. This tool targets ordinary double-quoted literals.
Why escape non-ASCII characters?
Some build setups compile with a non-UTF-8 encoding, which garbles accented characters. \u escapes are safe everywhere.
Is Java String Escape free and private?
Yes. Java String Escape is completely free with no sign-up. Everything runs in your browser, so whatever you type or paste never leaves your device.