JS String Escape / Unescape

Escape a string for safe embedding in JS code (handles \n, \t, \r, \" and non-ASCII Unicode). JSON-safe mode uses JSON.stringify rules. Reverse: unescape back to the original string. Runs in your browser.

Related tools