Should I use this tool instead of prepared statements?
No — and this is the most important thing on the page. Application code that touches a database in production should use prepared statements (parameter binding) every time. The driver handles escaping, type coercion, and dialect quirks correctly. This tool exists for the cases where parameters are not available: hand-written migrations, one-off DBA scripts, embedded SQL in tools that lack a binding API, and reading or rewriting legacy code that already concatenates strings. Treat it as a forensic and ops aid, not a security boundary.
How does this tool escape a single quote?
Per the ANSI SQL standard, every single quote is doubled: O'Brien becomes O''Brien. When the database parser encounters '' inside a string literal, it emits one literal apostrophe and continues. This works in PostgreSQL, SQL Server, Oracle, SQLite, and MySQL (in either default or ANSI_QUOTES mode).
What about backslash escaping in MySQL?
MySQL by default treats backslash as an escape character inside string literals — so a literal backslash must become \\ and a quote can also be written as \'. The tool doubles backslashes to \\ to remain safe under the default sql_mode. If your server runs with NO_BACKSLASH_ESCAPES set, the doubled backslashes are still correct because the tool also doubles quotes to '' rather than relying on \'.
Why does the tool also escape \n, \r, and the NUL byte?
Multi-line values inside SQL string literals are valid in most dialects but cause subtle bugs in shell heredocs, log parsers, and ETL pipelines that read SQL line-by-line. Encoding \n, \r, and \0 keeps the literal on a single line and avoids accidental statement termination on systems that interpret NUL as end-of-string.
Does escaping prevent SQL injection?
Correct escaping for the right dialect, applied to every string concatenated into a query, with no second-order injection from re-escaped data, prevents string-literal injection. But every one of those qualifiers is a footgun — and none of them protect identifiers (table or column names), LIMIT/OFFSET values, or LIKE wildcards. Prepared statements eliminate the entire class of bugs. Use them.
How do I escape a value for a LIKE pattern?
After escaping the string for SQL, you also need to escape the LIKE wildcards % and _. Pick an ESCAPE character (commonly backslash), prepend it before each literal % or _ in your search term, and add ESCAPE '\' to the LIKE clause. This tool handles only the SQL string escape — LIKE wildcard escaping is a separate step.
What about NULL values?
NULL is not a string and must be written as the bare keyword NULL (no quotes) in SQL. If your value can be NULL, branch in your script: emit NULL when the source is null, otherwise emit a quoted-and-escaped literal. This tool only handles the escape step for non-null strings.
Is my SQL data sent to a server?
No. Escaping is pure string substitution running in your browser. PII, customer records, and credentials in your migration scripts never leave the page. Verify in DevTools → Network — no request fires when you click Escape.