Java Escape / Unescape
Make text safe for a Java string literal — quotes, backslashes and control characters escaped and non-ASCII characters written as \uXXXX — or unescape it back, in your browser.
Suggested tools
About Java Escape / Unescape
Java Escape turns any text into a valid Java string literal: backslashes, quotes, new lines, tabs, backspaces and form feeds are escaped, and every character beyond ASCII is written as a \uXXXX escape, which keeps source files and .properties files safe in any encoding.
Unescape converts escaped text back to readable form, decoding \uXXXX, \xXX and all standard backslash sequences — useful for reading log output or resource bundles. Everything runs locally in your browser — the text you paste is never uploaded.
How to use Java Escape / Unescape
- Paste the text, or the escaped Java string.
- Press Escape or Unescape.
- Copy the result into your Java code or properties file.
Key features
- Escapes \ " ' \n \r \t \b \f
- Non-ASCII characters as \uXXXX (great for .properties)
- Decodes \uXXXX and \xXX on Unescape
- Escape and Unescape on one page
Example
The ₹ sign becomes a \u escape — safe in any source file or .properties file.
Price: ₹500 "Done"
Price: \u20b9500\n\"Done\"
When to use Java Escape / Unescape
- Writing strings with quotes or new lines into Java code.
- Preparing .properties files that contain non-English text.
- Reading \u-escaped text from Java logs.
Tips and common problems
- Old .properties files are read as ISO-8859-1 — keep non-ASCII text as \u escapes there.
- Java text blocks (""") need fewer escapes for multi-line text in Java 15+.
- Unescape works on log output, resource bundles and JSON strings alike.
Frequently asked questions
Older .properties files are read as ISO-8859-1, so characters like ગ or € must be written as \u escapes to survive. It is also safe for source files in any encoding.
Emoji are stored in Java as two UTF-16 code units, so each emoji becomes two \uXXXX escapes (a surrogate pair), which Java reads back correctly.
Yes, they use the same backslash escapes. Note that Kotlin also treats $ specially in strings.