SQL Escape / Unescape
Safely escape string literals for 8 SQL dialects. Handles newlines, quotes and null bytes correctly.
Input
Output
Frequently Asked Questions
+What does SQL string escaping do?
It lets you embed arbitrary text (with quotes, backslashes, newlines) inside a SQL string literal without breaking the query or risking SQL injection when building queries manually.
+Which dialects are supported?
MySQL, PostgreSQL, SQL Server, SQLite, Oracle, Snowflake, BigQuery, and Databricks. Each uses the correct escape rules for its grammar (backslash-based for MySQL/Databricks/BigQuery, doubled single quotes elsewhere).
+Is this safe for production code?
Prefer parameterized queries / prepared statements in application code. This tool is for one-off scripts, migrations, and debugging.
+Does it round-trip?
Yes — escape followed by unescape returns the original string byte-for-byte for all supported dialects.
Advertisement