JavaScript Escape
Escape or unescape JavaScript strings. Handles quotes, newlines, tabs, backslashes, and Unicode characters.
DevForge is free and ad-supported. Buy me a coffee if it saved you time.
How to Use This Tool
Paste your string into the input field, choose Escape or Unescape, then click the button. Escape converts a raw string into a safe JavaScript string literal. Unescape converts it back.
Common Use Cases
- Embed user-supplied text safely inside JavaScript string literals
- Debug escaped strings by reverting them to raw form
- Prepare strings for use in JSON or HTML attributes
Frequently Asked Questions
What characters are escaped?
Backslashes, single quotes, double quotes, newlines (\n), carriage returns (\r), tabs (\t), and null characters (\0) are escaped. Unicode characters above U+FFFF are escaped as \uXXXX sequences.
What is the difference between escape and unescape?
Escape converts a raw string into a JavaScript string literal — adding backslashes before special characters. Unescape does the reverse, converting a JavaScript string literal back to its raw form.
Is my data sent to a server?
No. All escaping and unescaping happens entirely in your browser. Your data never leaves your machine.