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

JSON Escape / Unescape

Turn text, JSON or XML into a JSON string literal, or unescape it back.

JSONTEXT
Open Tool

HTML Escape / Unescape

Encode < > & " ' as HTML entities, or decode entities back to text.

HTML
Open Tool

XML Escape / Unescape

Make text safe for XML elements and attributes, or decode it back.

XML
Open Tool

JavaScript Escape / Unescape

Turn text into a safe JS string literal, or unescape it back.

JavaScript
Open Tool

C# / .NET Escape / Unescape

Escape text for a C# or VB.NET string literal, or unescape it.

NET
Open Tool

CSV Escape / Unescape

Quote a value correctly for CSV, or unwrap a quoted CSV field.

CSV
Open Tool

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

  1. Paste the text, or the escaped Java string.
  2. Press Escape or Unescape.
  3. 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.

Input
Price: ₹500
"Done"
Output
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.