MySQL SQL Minifier

Free online MySQL SQL minifier. Compress MySQL queries to a single line, stripping whitespace and comments while preserving backtick identifiers, string literals, and MySQL-specific syntax.

⌘↵ to minify
Input SQL
Minified SQL

What is MySQL?

MySQL is the world's most widely deployed open-source relational database, powering billions of websites including WordPress, Drupal, and major e-commerce platforms. It is known for its speed, reliability, and ease of use, making it a core component of the LAMP (Linux, Apache, MySQL, PHP) stack.

MySQL supports a broad range of SQL features including transactions (InnoDB engine), full-text search, replication, and a rich set of built-in functions. Its tight integration with web frameworks and ORMs has made it the default database for many web application stacks.

The MySQL formatter correctly handles MySQL-specific syntax such as backtick-quoted identifiers, GROUP_CONCAT, LIMIT/OFFSET shorthand, and the ENGINE= table option, keeping your queries clean and readable.

Frequently asked questions

Will MySQL backtick identifiers be preserved when minifying?

Yes. MySQL backtick-quoted identifiers (e.g. `order`, `group`) are preserved exactly as written. Only whitespace between tokens is removed.

Does minification affect MySQL string literals?

No. String literals (single-quoted or double-quoted) are treated as opaque and their contents are preserved exactly — only whitespace outside literals and comments are removed.

Will MySQL comments be removed during minification?

Yes. Both -- single-line comments and /* */ block comments are stripped. MySQL's # comment syntax is also removed during minification.

Is minified MySQL SQL still valid and executable?

Yes. Minification only removes semantically insignificant whitespace and comments. The resulting SQL is functionally identical to the original and will execute correctly in MySQL.

Try Sequel

Query your database in plain English.

Connect your database and get instant answers without writing SQL. Free for up to 3 seats — no credit card required.

Get started free