JavaScript Escape

Your data never leaves your browser

Escape special characters in JavaScript strings: backslashes, quotes, newlines, and tabs.

Brie — Bug Reporting Tool

Found a bug while testing?

Brie captures screenshots, console logs, network data, and session replays in one click — so developers get the full context without the back-and-forth.

About JavaScript Escape

Convert raw text into a properly escaped JavaScript string literal. Backslashes, single quotes, double quotes, newlines, carriage returns, tabs, and null characters are all replaced with their escape sequences — making it safe to embed the text inside a JavaScript string.

How to use

  1. Paste the text you want to use inside a JavaScript string into the input panel.
  2. The escaped version appears instantly in the output panel.
  3. Click Copy and paste the result directly inside your JavaScript quotes.

More JavaScript / TypeScript Tools

Frequently Asked Questions

FAQs about JavaScript Escape

What characters are escaped?

Backslashes (\), single quotes ('), double quotes ("), newlines (\n), carriage returns (\r), tabs (\t), and null characters (\0) are all escaped.

When do I need to escape JavaScript strings?

Any time your string contains characters that would break the string literal syntax — such as a quote that matches the string delimiter, or a literal newline.

Does this add surrounding quotes?

No. The output is the escaped content only, without surrounding quotes. Add your own single or double quotes around it.

What about template literals?

If you are using template literals (backticks), you mainly need to escape backticks and ${ sequences. This tool escapes all common string characters suitable for quoted strings.

Is my data safe?

All processing runs entirely in your browser. No data is ever sent to a server.