Input

Mode:

Output

What is SQL Escaping?

SQL escaping is the process of making string values safe to include in SQL queries by converting special characters that could break the query or cause SQL injection vulnerabilities.

The most common escape in SQL is doubling single quotes: a single quote ' becomes ''. Backslashes may also need escaping depending on the database.

How to Use the SQL Escape Tool

1

Paste your SQL string

Paste the SQL string you want to escape into the input editor on the left.

2

Choose a mode

Select Escape to escape special characters or Unescape to reverse the escaping.

3

Copy or download

Copy the result to clipboard or download it as a .sql file.

SQL Escaping Example

Here is an example of SQL string escaping:

Raw SQL String

Input SQL

Escaped SQL String

Escaped SQL

When Does SQL Escaping Matter?

Always escape user-supplied input before including it in SQL queries to prevent SQL injection attacks. This is a fundamental security practice.

For formatting your SQL queries, try the SQL Formatter tool.

Frequently Asked Questions

What characters are escaped?

Single quotes ' are doubled to ''. Backslashes \ are doubled to \\.

Is this a replacement for parameterized queries?

No. Parameterized queries / prepared statements are the best defense against SQL injection. This tool is for manual escaping when needed.

Is my data sent to a server?

No. All processing is done entirely in your browser. Your SQL never leaves your device.

Related Tools

References: OWASP SQL Injection Prevention