String Escape & Unescape
Escape or unescape strings for JSON, regex and SQL.
Escape or unescape strings for JSON, regex and SQL. Free, instant and private in your browser.
Loading the interactive tool… This page needs JavaScript to run the String Escape & Unescape.
How to use String Escape & Unescape
- Paste the data, code, token, or value you need to inspect.
- Set any format, encoding, or validation options.
- Run the tool and inspect the result or diagnostic output.
- Copy the output into your terminal, editor, API client, or project.
How String Escape & Unescape works
Pick a mode and paste text. JSON escape turns quotes, backslashes and line breaks into backslash sequences, and the unescape mode reverses it. Regex mode puts a backslash before special characters such as the dot, star, plus and brackets. SQL mode doubles single quotes. These are text transformations and are not a substitute for parameterized queries.
Worked example
Input: O'Brien in SQL mode → Output: O''Brien. The text a.b*c in regex mode becomes a\.b\*c.
Common uses
- Prepare multi-line text for use inside a JSON string.
- Escape a literal such as a filename pattern before building a regular expression.
- Unescape a string copied from a log file to read it normally.
Best for
- debugging and development
- API work
- quick lookups
Tips for better results
- For SQL, prefer parameterized queries over manual escaping.
- Validate the output before using it in production code.
- Treat tokens, credentials, and secrets as sensitive even when processing happens locally.
- For large payloads, keep an original copy so you can compare changes.
Frequently asked questions
When do I need to escape strings?
Whenever text with quotes, newlines or special characters goes into code, JSON, SQL or a regex.
Is my data sent to a server?
No. This tool runs in your browser, so what you enter stays on your device.
Do I need an account to use String Escape & Unescape?
No account or sign-up is needed. Just open the tool and use it.
Related tools
- Regex Tester — Test JavaScript regex patterns.
- Query String Parser — Parse a URL query string into JSON.
- AI Token Cost Calculator — Estimate LLM API cost from tokens, requests and per-token prices.
- Base32 Encoder/Decoder — Encode or decode text as Base32.
- Base64 Encoder/Decoder — Encode or decode UTF-8 text as Base64.
- Chmod Calculator — Convert Linux file permissions between octal and symbolic.