Skip to content
MyDailyTool

String Escape/Unescape

Escape and unescape strings for JSON, JavaScript, HTML, and SQL. Handles special characters, backslashes, quotes, newlines, and Unicode escape sequences instantly.

How to use the string escape/unescape

Pick the target context (JSON, JavaScript, HTML, SQL). Edit the left side to escape, the right side to unescape.

Formula & explanation

JSON: uses JSON.stringify rules. JS: backslash-escapes quotes, backslash, and control chars. HTML: replaces &<>"' with named entities. SQL: doubles single quotes (the standard literal-string escape).

Examples

JSON: She said "hi" becomes She said \"hi\". SQL: it's becomes it''s (single quotes doubled).

Frequently asked questions

When should I use HTML escaping vs JSON escaping?
Use HTML escaping when inserting user-supplied text into an HTML page to prevent XSS. Use JSON escaping when embedding strings inside JSON payloads or configuration files.
Why does SQL escaping only double single quotes?
In standard SQL, string literals are delimited by single quotes, and a literal single quote inside a string is represented by two consecutive single quotes (''). This is defined by the SQL standard (ISO 9075).
What is the difference between JS and JSON escaping?
JSON escaping is a strict subset: it always uses double quotes and only escapes what the JSON spec requires. JS escaping is more permissive — it handles both single and double quotes and the same control characters.
Does this tool send my text anywhere?
No. All escaping and unescaping happens entirely in your browser with no data sent to any server.

Related developer tools tools