Introduction

JS String Escape Online is a free tool that escapes and unescapes special characters in JavaScript strings. Convert raw text into a safe JavaScript string literal, or decode an escaped string back to its original form.

How to use:

1. Enter or paste your text in the input box below.

2. Click "Escape" to escape special characters, or "Unescape" to convert escape sequences back to characters.

3. Use the copy button to quickly copy the result.

Input Text:

 

Result:

About JS String Escape Online:

When working with JavaScript strings, certain characters have special meaning and must be escaped with a backslash to be included literally. For example, double quotes inside a double-quoted string, newlines, tabs, and backslashes themselves all need to be escaped.

This tool handles all standard JavaScript escape sequences: backslash (\\), double quote (\"), single quote (\'), newline (\n), carriage return (\r), tab (\t), backspace (\b), form feed (\f), and null character (\0). It also converts non-ASCII characters to their Unicode escape sequences (\uXXXX).

This is particularly useful when embedding user-generated content into JavaScript code, building JSON strings manually, or debugging escape sequence issues. All processing happens entirely in your browser; your data is never sent to any server.