WebToolsPlanet
Developer Tools

Java Escape / Unescape

Escape any text into a safe Java string literal, or unescape a Java string back to plain text — all in your browser.

JavaEscapeUnescapeBrowser based

Last updated: May 30, 2026

Client-Side Processing
Input Data Stays on Device
Instant Local Execution

Find this tool useful? Support the project to keep it free!

Buy me a coffee

What is Java Escape / Unescape?

Java Escape / Unescape converts text to and from the escaped form used inside Java string literals. When you paste raw text, it adds the backslash escapes Java requires — \\ for a backslash, \" for a quote, \n, \r, \t, \b, \f — and can encode other characters as \uXXXX. Unescape does the reverse, decoding \n, \uXXXX and Java octal escapes (\0–\377) back to the original characters.

Everything runs locally in your browser, so code and data never leave your machine.

How to Use Java Escape / Unescape

1

Paste your text into the input box

2

Choose Escape to build a Java literal, or Unescape to decode one

3

Optionally enable \uXXXX escaping for non-ASCII characters

4

Copy the output into your Java code

Common Use Cases

  • Embedding a Windows file path or regex into a Java string without breaking it.
  • Pasting multi-line text into a Java string literal safely.
  • Decoding an escaped Java string from a properties file or log back to readable text.
  • Converting non-ASCII characters to \uXXXX for ASCII-only Java source.

Example Input and Output

Escape a Windows path and a multi-line message for a Java string literal.

Raw text
C:\temp\log.txt
Line two
Escaped Java
C:\\temp\\log.txt\nLine two

How This Tool Works

The tool scans your text character by character, replacing characters that are special in Java string literals with their escape sequences (or reversing that mapping when unescaping), entirely in the browser.

Technical Stack

TypeScriptJava string-literal rulesClient-side processing

Octal escapes

Java strings allow octal escapes like \101 (the letter A). The unescaper decodes them following the \0–\377 rule.

Privacy

Processing is fully client-side — nothing is sent to a server.

Frequently Asked Questions

Which escapes does it support?
Escaping emits \\ \" \n \r \t \b \f and optional \uXXXX. Unescaping also decodes Java octal escapes such as \101.
Does Java support \a or \v?
No. Unlike C#, Java has no \a or \v escapes, so those characters are written as \u0007 and \u000B instead.
Will it escape Unicode characters?
Only if you enable the non-ASCII option; otherwise printable Unicode is left as-is, which valid Java source supports.
Is my input uploaded?
No. Escaping and unescaping run entirely in your browser.