SQL Escape

Escape single quotes, double quotes, backslashes, and special characters for SQL queries. All processing happens in your browser β€” your data never leaves your machine.

πŸ” SQL Escape

Escape mode:
Try an example:
Characters: 0 Lines: 1 Mode: SQL Escape ('' quotes)

How to Use the SQL Escape Tool

SQL Escape ('' quotes)

This is the standard SQL escape method. Every single quote ' inside a string literal is doubled to ''. This is the most common and widely supported SQL escape technique, used by MySQL, PostgreSQL, SQLite, Oracle, and most other databases.

Input:  It's a great day
Output: It''s a great day

SQL Escape (\' backslash)

Some databases (notably MySQL with NO_BACKSLASH_ESCAPES disabled) support C-style backslash escaping. This mode prepends a backslash before single quotes, double quotes, backslashes, and control characters like newlines and tabs.

Input:  It's a "test" with \backslash
Output: It\'s a \"test\" with \\backslash

JSON Escape

Use this when embedding string values inside JSON or when constructing JSON that will be stored in a SQL column. This mode escapes double quotes, backslashes, newlines, tabs, and other control characters using standard JSON escape sequences.

Input:  {"name": "O'Brien", "path": "C:\data"}
Output: {\"name\": \"O'Brien\", \"path\": \"C:\\data\"}

Unescape All

Reverts escaped strings back to their original form. Handles both doubled-quote SQL escaping ('' β†’ ') and backslash escaping (\' β†’ ', \\ β†’ \), as well as JSON escape sequences.

Input:  It''s a \"test\" with \\backslash
Output: It's a "test" with \backslash

Auto-Escape

As you type in the input box, the output updates automatically with a small debounce delay of 300ms. You can also press Ctrl+Enter to trigger escaping immediately.

Related Tools

SQL FormatterΒ· SQL ValidatorΒ· SQL MinifierΒ· SQL to JSON