JavaScript String Escape & Unescape
Escape text into a safe JavaScript string literal. This tool does both escape and unescape on one page — just pick a mode, paste your text, and click. Everything runs on your device, nothing is sent to a server.
Everything runs in your browser. Your data is never sent to our servers.
Example
Example Input
a b"c
Example Output
a\tb\"c
How to Use
- 1Choose Escape or Unescape mode at the top.
- 2Type or paste your text into the Input field.
- 3Click the button (or press Ctrl+Enter) to process. The result appears in the Output field.
- 4Click Copy to copy the result, or "Swap input/output" to quickly reverse the operation.
About JavaScript String
JavaScript Escape turns text into a form safe to place inside a JavaScript string literal — escaping quotes, backslashes, newlines, tabs, and other special characters.
How it works: characters that would break a string literal (like " ' \ and newlines) are converted to escaped forms (\n, \", etc.). Unescape reverses it, understanding \uXXXX and \xXX too.
JavaScript Escape is useful when embedding text into JS code — e.g. making a string from multiline or quote-containing content, without causing syntax errors.
FAQ
Can this JavaScript String tool both escape and unescape?
Yes. This is a single page with a toggle — use Escape mode to transform text, and Unescape mode to reverse it. No need for two separate pages.
Is my data sent to a server?
No. JavaScript String is processed entirely in your browser. The text you enter never leaves your device.