SQL Escape / Unescape
Double the single quotes in text so it fits inside a SQL string literal ('O''Brien'), or turn doubled quotes back into one — in your browser.
Suggested tools
About SQL Escape / Unescape
SQL Escape prepares text to be placed inside a single-quoted SQL string by doubling every single quote — so O'Brien becomes O''Brien, which is the standard escaping in MySQL, PostgreSQL, SQL Server, Oracle and SQLite. Unescape turns doubled quotes back into one.
Use it for one-off queries, migration scripts and test data. In application code, always use parameterised queries instead of building SQL strings. Everything runs locally in your browser — the text you paste is never uploaded.
How to use SQL Escape / Unescape
- Paste the text you want to put inside quotes, or an escaped SQL string.
- Press Escape or Unescape.
- Paste the result between single quotes in your query.
Key features
- Standard SQL quote doubling ('')
- Works for MySQL, PostgreSQL, SQL Server, Oracle and SQLite
- Unescape for reading values back
- Escape and Unescape on one page
Example
Ready to place between single quotes: WHERE note = '…'.
O'Brien's order
O''Brien''s order
When to use SQL Escape / Unescape
- Writing names like O'Brien into hand-written SQL or migration scripts.
- Preparing seed data that contains apostrophes.
- Reading values with doubled quotes from SQL dumps.
Tips and common problems
- In application code, always use parameterised queries instead of escaping by hand.
- MySQL also treats backslash as an escape character by default; double backslashes too.
- Escape only the value, then wrap it in single quotes in the query.
Frequently asked questions
Quote doubling handles quotes in string literals, but the safe way to use user input in applications is parameterised queries (prepared statements). Use this tool for hand-written SQL, not as a security layer.
With MySQL's default settings, backslash is also an escape character inside strings. If your text contains backslashes, double them as well, or enable the NO_BACKSLASH_ESCAPES mode.
No. Those only matter inside LIKE patterns, where you escape them with an ESCAPE clause.