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.
String Escape/Unescape
Escape/unescape strings for programming languages
lightbulbPopular Use Cases
Escape quotes and special characters for JSON strings
Escape strings for use in JavaScript/TypeScript code
Convert escaped strings back to readable text
Escape multiline text for single-line string literals
Escaped String will appear here
Example Inputs
He said "Hello, World!"
He said "Hello, World!"
Line 1 Line 2 Line 3
Keyboard Shortcuts
keyboardShow shortcutsexpand_more
Related tools
Show moreShow 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.