SQL Escape

Paste text to escape the quotes (and, for MySQL, backslashes and control characters) so it can be placed safely inside a SQL string literal.

  • Runs in your browser
  • Free to use
ctrl + enter

About this tool

Pasting text with apostrophes into a SQL statement breaks it, or worse. SQL Escape rewrites the text for a string literal in your browser: standard quote doubling for every database, or MySQL backslash escaping that also covers newlines, NUL and Ctrl-Z, optionally wrapped in quotes and ready to paste into an INSERT or UPDATE.

Related: SQL Formatter.


How to use it — quick steps

  1. 01

    Enter the text

    Type or paste the text in the field above, for example It's a "test" with a \ backslash.

  2. 02

    Adjust the options

    Pick the settings that fit your case; the defaults work for most people. Changes apply instantly.

  3. 03

    Press "Escape text"

    Press "Escape text" or Ctrl + Enter. The result appears instantly below the form. Results can be copied.


Key features of this tool

  • Nothing leaves your browser

    The processing is plain JavaScript that runs on your device: the text you paste is never uploaded to our servers or to anyone else.

  • Instant results

    Results appear the moment you press the button, even for long inputs, and every block has copy and download actions.

  • Works everywhere

    No installation, no account and no limits: the tool works on desktop and mobile, in any modern browser, as often as you like.


Frequently asked questions

Which style should I use?

Quote doubling ('') is the SQL standard and works in PostgreSQL, SQLite, SQL Server, Oracle and MySQL. Backslash escaping is MySQL/MariaDB-specific and also handles newlines and NUL bytes.

Is this safe against SQL injection?

Escaping makes a literal syntactically safe, but parameterised queries (prepared statements) are the correct defence; use this tool for one-off scripts, fixtures and migrations.

Are my files or data uploaded?

No. The tool is plain JavaScript that runs in your browser; the files or data you provide here are never uploaded to our servers.


Popular tools


From APIVoid, the team behind IPVoid

Enhance your threat detection capabilities

APIVoid provides threat intelligence APIs to automate security workflows, with simple pricing and a 30-day free trial to start, no card required.

What you get with APIVoid

  • IP reputation and blacklist checks
  • Domain and URL reputation scoring
  • DNS lookups and propagation
  • SSL certificate and TLS details
  • Website screenshots and page info
  • Email address verification
  • 30+ cybersecurity APIs
30-day free trial