String Escape
Convert raw text into escaped string-literal form for code snippets, testing, debugging, and serialization.
String Escape tool
Newlines, tabs, carriage returns, backslashes, quotes, and control characters will be escaped. Press Ctrl/Cmd + Enter to convert.
| Metric | Value |
|---|
Privacy: escaping runs locally in your browser. No text is stored or transmitted.
This tool converts raw text into string-literal-safe escaped text. It escapes backslashes, quotes for the selected quote style, line breaks, tabs, and other control characters.
Examples
- Line break → \n
- Tab → \t
- "Hello" → \"Hello\" in double-quote mode
FAQ
- What does string escape do?
It converts special characters such as newlines, tabs, backslashes, and quotes into escaped forms suitable for string literals.
- Is this only for JavaScript?
This tool follows common JavaScript-style escape sequences like \n, \t, \\, \", and \uXXXX, which are also familiar in many programming contexts.
- Can I choose the quote style?
Yes. You can escape for double-quoted or single-quoted string contexts, and optionally wrap the output with quotes.
- Is my text stored?
No. Escaping runs locally in your browser and nothing is stored or transmitted.