This tool escapes special characters in text so it can be safely used in Java string literals. It converts characters like quotes, backslashes, newlines, tabs, and other control characters into their escaped representations (e.g., \" \\ \n \t).
Java string escaping is the process of converting special characters into escape sequences that can be safely included in Java string literals. When you include a string in Java code, certain characters have special meaning and must be escaped with a backslash (\).
| Character | Escape Sequence | Description |
|---|---|---|
| " | \" | Double quote |
| ' | \' | Single quote |
| \ | \\ | Backslash |
| Newline | \n | Line feed (LF) |
| Carriage Return | \r | Carriage return (CR) |
| Tab | \t | Horizontal tab |
| Backspace | \b | Backspace |
| Form Feed | \f | Form feed |
Input: Hello "World"
How are you?
Output: Hello \"World\"\nHow are you?