Advertisement

Text Escape Tool

Escape text for code for free. Convert plain text into safe HTML, JavaScript, JSON, CSV, URL, SQL or regex form, and unescape it back. Runs in your browser.

Text input

Paste your text, choose a format, then escape or unescape.

Result

Waiting for input.

Advertisement

What text escaping does

Special characters break code when pasted raw: quotes end strings early, angle brackets become tags, and newlines are illegal inside single-line strings. Escaping rewrites those characters into safe sequences the target language understands.

This tool covers the seven formats developers reach for most, HTML, JavaScript, JSON, CSV, URL, SQL and regex, each with a matching unescape direction.

When to use each format

Use HTML entities when injecting user text into a page, JSON escaping when building API payloads by hand, and URL encoding for query parameters. CSV escaping matters when a field itself contains commas or quotes, and SQL escaping is a last resort, parameterized queries are always safer.

Regex escaping is handy when you want to search for literal text like prices ($9.99) without the dots and dollar sign acting as pattern operators.

Text Escape Tool FAQs

What is the difference between escape and unescape?
Escape converts plain text into a safe coded form for a language. Unescape reverses it, turning the coded form back into readable plain text.
Should I use this instead of parameterized SQL queries?
No. Escaping quotes helps in a pinch, but parameterized queries are the correct defense against SQL injection. Never rely on escaping alone for database input.
Why does my JSON string fail to parse?
Common causes are unescaped quotes, literal newlines inside the string, or trailing commas. Paste it here, escape as JSON, and compare with your original to spot the break.
Does URL encoding handle spaces?
Yes. Spaces become %20, which is the correct encoding for URLs. Form-style plus signs (+) are a different convention used only in form submissions.
Is my text sent to a server?
No. All escaping and unescaping runs locally in your browser.
Advertisement