SQL String Escape Tool
Escape single quotes, backslashes, and special characters in strings for safe SQL queries.
Use the SQL String Escape Tool
Options
Escape Summary
Input length
0
Output length
0
Characters escaped
0
Dialect
MySQL
Escape Rules by Dialect
| Dialect | Single quote | Backslash | NULL byte |
|---|---|---|---|
| MySQL | \' | \\ | \0 |
| PostgreSQL | '' | no change | removed |
| SQLite | '' | no change | removed |
| MSSQL | '' | no change | removed |
Summary
Paste any string and instantly get the properly escaped version safe to embed inside SQL query literals. Supports MySQL, PostgreSQL, SQLite, and MSSQL dialects. All processing happens in your browser — no data is sent to any server.
How it works
- Paste or type your raw string into the input field.
- Select the SQL dialect that matches your database (MySQL, PostgreSQL, SQLite, or MSSQL).
- The escaped output appears instantly, ready to paste into your SQL statement.
- Use the Copy button to copy the escaped value to your clipboard.
- Toggle "Wrap in quotes" to include the surrounding single quotes in the output.
Use cases
- Escape user-supplied input before building a raw SQL query string.
- Prepare string literals for database seed scripts and migration files.
- Debug query building by seeing exactly how a value will appear inside SQL.
- Convert multi-line or binary strings into SQL-safe representations.
- Test escaping behavior across different database engines.
- Quickly escape JSON blobs or HTML snippets stored in TEXT columns.
Frequently Asked Questions
Last updated: 2026-05-23 · Reviewed by Nham Vu