About

String Escape Tool – Escape/Unescape for JS, HTML, SQL, JSON

Prepare strings for JavaScript, JSON, HTML, SQL, regex, and CSV contexts with precise escaping/unescaping rules for each target format.

🟢 Runs locally · no uploads

String Escape/Unescape

Escape/unescape strings for programming languages

lightbulbPopular Use Cases

data_object
JSON Strings

Escape quotes and special characters for JSON strings

code
JavaScript Code

Escape strings for use in JavaScript/TypeScript code

unlock
Unescape Text

Convert escaped strings back to readable text

view_headline
Multiline Text

Escape multiline text for single-line string literals

Text Input
String Output
output

Escaped String will appear here

code_blocksExample Inputs

Quotes (Escape)
He said "Hello, World!"
Escaped String (Unescape)
He said "Hello, World!"
Newlines (Escape)
Line 1
Line 2  
Line 3

keyboardKeyboard Shortcuts

keyboardShow shortcutsexpand_more
Ctrl+EnterProcess
Ctrl+LClear All

Related tools

Show more
Show more
› About this tool · FAQ

Escape and unescape strings for various programming languages and formats including JavaScript, JSON, HTML, XML, CSS, SQL, RegEx, URL, CSV, and Python.

What's the difference between JavaScript and JSON escaping?

JavaScript and JSON escaping are very similar, but JSON is more strict. Both handle quotes, backslashes, and control characters the same way. The tool treats them identically for practical purposes.

When should I escape Unicode characters?

Enable Unicode escaping when you need ASCII-only output or when working with systems that don't handle Unicode well. Otherwise, leave it disabled for better readability.

Why does my CSV text get wrapped in quotes?

CSV escaping adds quotes around text that contains commas, quotes, or line breaks. This is the standard CSV format to preserve the data structure.

Can I unescape text that wasn't escaped by this tool?

Yes, the unescape function works with any properly escaped text, regardless of which tool created it. However, malformed escape sequences may not process correctly.

What does "preserve line breaks" do?

When enabled, actual line breaks in your text are maintained. When disabled, they are converted to escape sequences like \n.