Javascript Escape/Unescape

Form of JavaScript Escaping/Unescaping

Enter JS code here to escape/unescape:

Press F11 to switch to fullscreen mode
Move to "Paste Code" for Saving

About online JavaScript escape/unescape

About JS escape/unescape

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

The JavaScript Escape / JavaScript Unescape tool was created to help with escape special unicode characters into a quoted string literal value for JavaScript source code and also unescape it.

What characters are replaced?

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 \\

How it Works?

Just paste your JS code to the textarea above and click to the button "Escape" or "Unescape" and you will get your escaped/unescaped data.

Example of JavaScript Escaping

JS before:
$(function() {
    function bestWebTools(){
        alert("escape js online");
    }
});
After:
$(function() {\r\n    function bestWebTools(){\r\n        alert(\"escape js online\");\r\n    }\r\n});
After the conversion, you can apply the JS code to your project or use it for some other purpose.