SQL Escape

SQL Escape

Updated August 21, 2026

SQL escape and identifier quoting online. Quote string literals and column names for PostgreSQL, MySQL, SQLite, or SQL Server. Unescape pasted SQL too.

Dialect

Input

SQL

Features

  • Escape string literals with doubled quotes or MySQL backslashes
  • Quote identifiers for Postgres, MySQL, SQLite, SQL Server, BigQuery
  • Unescape a pasted literal back to raw text
  • Live preview as you type
  • Nothing is uploaded

Common Use Cases

  • Build a VALUES clause from a user-supplied name
  • Quote a column that is also a reserved word (user, order, group)
  • Turn a copied SQL literal back into the original string
  • Switch identifier quotes when moving a query from MySQL to Postgres

String literals vs identifiers

SQL uses two quoting systems. String literals use single quotes: 'Ada''s' is the text Ada’s. Identifiers (table and column names) use double quotes in PostgreSQL and SQLite, backticks in MySQL, and brackets in SQL Server.

Mixing them is a common bug: WHERE name = "Ada" is an identifier comparison in Postgres, not a string. Escape the value here, then paste it into the query.

Examples

Valid - String with apostrophe
Ada's book
Valid - Reserved identifier
order
Valid - Already-quoted literal
'O''Reilly'

Frequently Asked Questions

How do I escape a single quote in SQL?

In PostgreSQL, SQLite, and SQL Server, double it: 'O''Reilly'. MySQL also accepts a backslash. This tool emits the form for the dialect you pick.

Should I quote every column name?

Only when the name is a reserved word, has spaces, or must keep case. Quoted identifiers become case-sensitive in Postgres.

Tips

  • Prefer bound parameters in application code. This page is for one-off SQL and seeds.
  • Postgres dollar quotes avoid quote doubling for long text, but they are not portable.