JavaScript String Escape / Unescape

Escapes or unescapes a JavaScript string removing traces of offending characters that could prevent interpretation.

The following characters are reserved in JavaScript and must be properly escaped to be used in strings:

  • Horizontal Tab is replaced with \t
  • Vertical Tab is replaced with \v
  • Nul char is replaced with \0
  • Backspace is replaced with \b
  • Form feed is replaced with \f
  • Newline is replaced with \n
  • Carriage return is replaced with \r
  • Single quote is replaced with \'
  • Double quote is replaced with \"
  • Backslash is replaced with \\

Copy-paste the string to escape or unescape here