https://devtools.solutions/tools/encoding/escape-js.html

Escape JavaScript String

Escape special characters in a JavaScript string literal, including quotes, backslashes, and control characters.


    

Example input/output

Input: She said "hello" and it's fine

Output: She said \"hello\" and it\'s fine

How it works

This tool escapes backslashes, single quotes, double quotes, and control characters (\n, \r, \t) with the appropriate JavaScript escape sequences. Processing runs in your browser.

Common use cases

Related tools