Surrogate pair output
Some tools emit invalid single \u escapes for astral chars.
Fix: This tool encodes BMP chars; beyond-BMP characters should use pre-split surrogate pairs.
header • up to 320x100 / 728x90
Round-trip Java string literals — escape quotes, backslashes, newlines, and Unicode sequences
Output will appear here...
content bottom • up to 300x250
sidebar • 160x600
Last reviewed:
Java is a statically typed, object-oriented language used heavily in enterprise backends, Android development, and large-scale distributed systems.
Java Escape / Unescape converts arbitrary text into a Java-safe string literal or reverses the operation. It escapes non-ASCII characters as \uNNNN and handles \n, \t, \b, \f, \r, \", and \'.
It is a daily driver for Java developers embedding literals in code generators, writing test fixtures, parsing .properties files, or decoding minified Kotlin output.
"Hello" – world Zürich
\"Hello\" \u2013 world\nZ\u00fcrich
Some tools emit invalid single \u escapes for astral chars.
Fix: This tool encodes BMP chars; beyond-BMP characters should use pre-split surrogate pairs.
By default, non-ASCII is escaped as \uNNNN.
Fix: That's intentional — perfect for Java .properties files.
Yes — any character outside 0x20–0x7E is encoded as \uNNNN.
Yes — the same escape rules apply.
Only within the Basic Multilingual Plane. Astral chars need explicit surrogate pairs.
\r\n is preserved on unescape; escape produces \r\n sequences.
No — everything runs client-side.
Pair Java escape with JSON, XML, and C# helpers when porting between ecosystems. You can also browse the full Encoders & Decoders category for more options.
Escape or unescape C# string literals including \x, \u, and \U Unicode escape sequences
Escape or unescape XML special characters and numeric entities with one click
Escape JSON special characters
Escape or unescape JavaScript string literals with backslash, quote, Unicode, and control-character handling
Convert text to HTML entities or decode HTML entities back to text in a single bidirectional tool
Escape or unescape SQL string literals using standard single-quote doubling
Escape strings for Java
Wrap a raw string in a JSON string literal — perfect for embedding content in a JSON payload
Wrap an XML document in a JSON string literal for safe embedding in payloads
Encode or decode HTML entities
Encode text to HTML entities
Encode or decode JSON strings