String Escaper & Unescaper Suite
Escape and unescape strings for JSON, SQL, RegEx literals, Bash shell quotes, and HTML entities locally in your browser.
Escape and unescape strings for JSON, SQL queries, RegEx metacharacters, and Shell syntax.
How to use this tool
100% Client-Side String Encoding
All string escaping, unescaping, and character replacements happen inside your local browser memory. No sensitive strings, query fragments, or credentials are sent to remote servers.
How to Escape and Unescape Strings
Safely embed dynamic strings across programming languages and data formats.
Input String
Type or paste your raw text, query snippet, or escaped literal into the editor box.
Select Format
Pick your target format: JSON String, SQL Query, RegEx Literal, Bash Shell, or HTML Entities.
Toggle & Copy
Select ‘Escape’ to encode characters or ‘Unescape’ to decode back to plain text, then copy the result.
Supported Language & Syntax Rules
Understand how characters are converted across different syntaxes.
| Format | Escaped Characters | Transformation Rule | Example |
|---|---|---|---|
| JSON | ", \, newlines, tabs |
Prepend backslash (\", \\, \n, \t) |
"hello\nworld" |
| SQL | Single quote (') |
Double the single quote ('') |
O''Reilly |
| RegEx | . * + ? ^ $ {} () | [] \ |
Prepend backslash before metacharacters | price\.\$USD |
| Shell / Bash | ', \, control chars |
Wrap in single quotes and escape ' |
'echo '\''hello'\''' |
| HTML | < > & " ' |
Convert to corresponding HTML entities | <div> & " |
Frequently Asked Questions
Understanding string escaping rules and code safety.
What is the difference between escaping and unescaping?
Escaping adds backslashes, entity codes, or duplicate quotes to ensure special characters are treated as literal text rather than syntax in code or queries. Unescaping reverses this process, decoding the special sequences back into raw human-readable text.
Why are SQL single quotes escaped with another single quote?
In SQL standards (ANSI SQL, PostgreSQL, SQLite, MySQL), single quotes delimit strings. To include a literal single quote inside a string without terminating the query early, standard SQL doubles the quote ('O''Connor').
Can this escape dynamic user input for RegExp constructors?
Yes! When building regular expressions dynamically with new RegExp(...), characters like ., +, ?, and $ will act as regex wildcards unless escaped. Choosing the ‘RegEx Literal’ format ensures user input matches literally.
Does this replace parameterized database queries?
No. While escaping single quotes is useful for quick debugging, testing, or migration scripts, always use prepared statements (parameterized queries) in production applications to prevent SQL injection vulnerabilities.
Privacy & Safety Policy
All tools run completely in your browser via client-side JavaScript. We do not upload your files, interest parameters, or JSON payloads to any server. Your data remains yours.