SQL Escape / Unescape
runs in your browserno sign-upfree
Escape text for an SQL string: double single quotes ('') or MySQL backslash escapes.
Escaped
About this tool
This tool escapes text so it can be placed inside an SQL string literal. The standard way, which works in every database, doubles each single quote: O'Reilly becomes O''Reilly. MySQL and MariaDB also accept backslash escapes (\' \n \\), which you can choose instead. Unescape reverses either style.
How to use
- Choose the style: Standard ('') or MySQL (\').
- Choose Escape or Unescape and paste your text.
- Optionally wrap the result in single quotes, then copy it.
FAQ
Should I build queries with escaped strings?
For application code, no — use prepared statements or parameters (for example ? or $1 placeholders), which keep data separate from SQL and prevent SQL injection. This tool is handy for one-off queries, seed files and migrations.
Which style should I use?
Standard ('') works in MySQL, PostgreSQL, SQL Server, SQLite and Oracle. Use MySQL (\') only for MySQL or MariaDB with default settings.
Is my text uploaded?
No. Escaping runs entirely in your browser, so your text never leaves your device.