Loading…

How to use JS String Escaper

Choose Escape or Unescape, paste your text, pick the quote character, then click Convert and copy the result.

Frequently asked questions

What does escaping do?

Escaping turns special characters — newlines, tabs, quotes, backslashes and control characters — into their JavaScript escape sequences so the text can be safely pasted inside a string literal.

Is the conversion reversible?

Yes. Unescaping decodes \n, \t, \r, \b, \f, \v, \0, \xXX, \uXXXX and \u{...} back to the original characters, so escape then unescape returns your exact input.

Which quote should I pick?

Pick the quote you will wrap the string in. The escaper escapes only that quote character, leaving the other quote untouched for cleaner output.

More JavaScript Tools

JS Unicode Escaper
Escape non-ASCII characters to \\uXXXX sequences so source stays ASCII-safe, or decode \\uXXXX, \\u{...} and \\xXX back to text
JS Regex Escaper
Escape a literal string so its special characters are matched literally inside a RegExp, with optional forward-slash escaping
Template Literal → Concat
Convert ES6 template literals with ${expr} interpolation into equivalent string concatenation, string and regex aware
Ternary to If/Else
Expand ternary assignments, declarations and returns into readable if/else blocks, safely skipping ?? and ?. operators
List to JS Array
Turn a list of lines, comma or space separated values into a JavaScript array literal with quoting, trimming and de-duplication
JS Variable Name Validator
Check whether a name is a valid JavaScript identifier and explain each problem — digits, symbols, spaces or reserved keywords
JS Quote Normalizer
Convert JavaScript string quotes between single and double, string, comment and regex aware, re-escaping quotes as needed
JSON Key Sorter
Recursively sort the keys of a JSON object alphabetically (ascending or descending) with configurable indentation
var to let / const
Replace the var keyword with let or const across your code, string, comment and regex aware so text like \
JavaScript Formatter
Beautify and format JavaScript code with proper indentation and structure for better readability
JavaScript Minifier
Minify JavaScript by removing whitespace, comments, and shortening variable names to reduce file size
JavaScript Validator
Validate JavaScript syntax and find errors with detailed line numbers and error messages

← View all JavaScript ToolsBrowse all 1,100+ tools →