JavaScript Escape/Unescape

Escape and unescape JavaScript strings β€” convert special characters to escape sequences.

EscapeUnescapeJavaScriptSequences
Plain Text
42 chars
Escaped Output

Output will appear here

Start typing to see live output

All escaping/unescaping happens locally in your browser β€” your data never leaves your device.

JavaScript Escape converts special characters to their escape sequences (\n, \t, \u sequences, etc.).

This tool lets you escape text for use in JavaScript string literals and unescape escape sequences back to readable text.

Perfect for embedding user content in JavaScript, creating JSON strings, or handling special characters in code.

Escaping Quotes and Newlines

Input: He said "Hello"\nHow are you?
Output: He said \"Hello\"\nHow are you?

Quotes are escaped with backslash, newlines become \n sequence.

Escaping Tabs and Special Characters

Input: Column1	Column2
Output: Column1\tColumn2

Tab characters are converted to \t escape sequences.

Unicode Escaping

Input: Hello πŸ˜€ World
Output: Hello \ud83d\ude00 World

Unicode characters are encoded as \uXXXX sequences.

Escaped quotes still cause syntax errors

You may be using the escaped string outside of quotes or mixing quote types.

Ensure the escaped string is placed inside quotes of the same type used during escaping.

Unicode escapes show as literal text

The terminal or editor may not interpret \u sequences automatically.

Use JSON.parse() or eval() to interpret the escaped string in JavaScript.

When should I use JavaScript escaping?

Use it when you need to embed text in JavaScript string literals, create JSON strings, or safely include user-generated content in JavaScript code.

What is the difference between \u and \x?

\uXXXX is for 4-digit Unicode code points (Unicode Escape). \xHH is for 2-digit hex values (Hex Escape). \u is more commonly used and recommended.

What characters get escaped?

Quotes (both single and double), backslash, newline (\n), carriage return (\r), tab (\t), form feed (\f), backspace (\b), and non-ASCII characters (as \uXXXX).

Is my data secure?

Yes. All escaping and unescaping happens locally in your browser. Your data never leaves your device.