SQL String Escape
Escape text for use inside a SQL string literal by doubling single quotes (standard SQL) or using MySQL backslash escapes. Unescape back too. Free tool.
Runs in your browser. Nothing is uploaded.
About SQL String Escape
In SQL a string literal is wrapped in single quotes, so a quote inside the value must be escaped. Standard SQL (PostgreSQL, SQL Server, SQLite, Oracle) doubles it: O'Reilly becomes 'O''Reilly'. MySQL also accepts backslash escapes for quotes, line breaks and NUL bytes.
Use this for one-off scripts, seed data and manual queries. In application code, always use parameterised queries instead of building SQL by hand.
How to use SQL String Escape
- Type or paste your text into the input box. Press Sample to see an example.
- Adjust the options. The result updates as you type.
- Copy the result, or press Use as input to chain another transformation.
Frequently asked questions
Does escaping prevent SQL injection?
Correct escaping helps, but parameterised queries (prepared statements) are the reliable defence and should be used in code.
How do I escape a double quote?
Inside a single-quoted string, double quotes need no escaping in standard SQL. Double quotes are for identifiers.
Is SQL String Escape free and private?
Yes. SQL String Escape is completely free with no sign-up. Everything runs in your browser, so whatever you type or paste never leaves your device.