Output will appear here
Output will appear here
JavaScript String Escape / Unescape
Escape special characters for safe use inside JavaScript string literals, or unescape escaped strings back to their original form. Handles quotes, newlines, tabs, null bytes, and Unicode.
Use Cases
- Prepare strings for embedding in JavaScript source code
- Escape user input for safe use in dynamically generated scripts
- Debug escaped strings by converting them to readable text
- Convert multi-line text to a single-line JavaScript string
- Escape content for use in template literals or eval contexts
Frequently Asked Questions
What characters are escaped?
Backslashes, single quotes, double quotes, newlines (\n), carriage returns (\r), tabs (\t), null bytes (\0), and Unicode line/paragraph separators (U+2028, U+2029).
Is this different from JSON escaping?
Yes. JavaScript string escaping handles single quotes and additional escape sequences like \0 and \x hex escapes that are not part of the JSON specification.