String Escaper / Unescaper
Escape or unescape strings for JavaScript, HTML, JSON, SQL, Regex, CSV and XML instantly.
What is String Escaper?
A string escaper converts raw text into a safely encoded form that can be embedded inside code, markup, or data formats without breaking the surrounding syntax. Every programming language and data format has its own set of reserved characters that must be escaped — for example, a double quote inside a JavaScript string literal must be written as a backslash followed by a double quote, and an ampersand inside HTML must be written as the entity reference.
This tool handles escaping and unescaping for seven common targets: JavaScript strings, HTML entities, JSON string values, SQL string literals, regular expressions, CSV fields, and XML. It works in both directions — you can escape raw text before embedding it in code, or unescape encoded strings back to their original human-readable form.
Common use cases include sanitising user input for safe SQL insertion (though parameterised queries are always preferred), preparing strings for inclusion in JSON configuration files, encoding HTML for display in a browser, escaping special characters in a regex pattern, and formatting CSV values that contain commas or quotes. Having all these converters in one place removes the need to hunt for format-specific tools and reduces the risk of manual encoding mistakes that can cause security vulnerabilities or parse errors.
How to Use String Escaper
- Enter your string
Paste or type the text you want to escape or unescape into the input field.
- Select the target format
Choose from JavaScript, HTML, JSON, SQL, Regex, CSV, or XML depending on where the string will be used.
- Escape or unescape
Click "Escape" to encode special characters, or "Unescape" to decode an already-encoded string back to plain text.
- Copy the result
Copy the output to your clipboard and paste it directly into your code or data file.
Key Benefits
Handle JavaScript, HTML, JSON, SQL, Regex, CSV, and XML escaping without switching between multiple tools.
Escape raw text for embedding in code, or unescape encoded strings to read them in plain form.
Results appear immediately as you type — no need to click a button for each change.
All processing happens locally in your browser. Sensitive strings never leave your machine.
Frequently Asked Questions
Backslashes, single quotes, double quotes, newlines (n), carriage returns (r), tabs (t), and null characters are all escaped.
String escaping reduces risk but parameterised queries are the recommended defence against SQL injection. Use this tool for display or debugging purposes.
HTML escaping replaces characters like < and & with entity references for safe display in HTML. URL encoding (percent-encoding) is different and used in query strings.
Yes. Unicode sequences such as backslash-u followed by a hex code in JavaScript strings are unescaped back to their UTF-8 characters.