SQL Minifier
Free online SQL minifier. Paste any SQL query and instantly get compact, single-line SQL with all whitespace and comments removed. Supports PostgreSQL, MySQL, Snowflake, BigQuery, SQLite, Redshift, Spark, MariaDB, SQL Server, and ClickHouse. Runs entirely in your browser — nothing is sent to any server.
What is an SQL Minifier?
An SQL minifier compresses SQL queries into the smallest possible form by stripping all unnecessary whitespace, newlines, and comments while preserving the query's exact semantics. The resulting minified SQL is functionally identical — it produces the same results and the same execution plan as the original.
Minified SQL is useful when embedding queries in application source code strings, passing SQL as URL query parameters, storing queries in JSON configuration files, reducing query log output size, or building dynamic SQL strings in code where readability is less important than compactness.
This minifier supports 10 SQL dialects and understands each dialect's quoting rules and string literal boundaries, ensuring that string contents and dialect-specific operators are preserved exactly while all surrounding whitespace is safely removed. It runs entirely in your browser.
Frequently asked questions
What is SQL minification?
SQL minification compresses a SQL query into the smallest possible form by removing all unnecessary whitespace, newlines, and comments while keeping the query semantically identical. The resulting SQL executes exactly the same as the original.
When should I minify SQL?
Minified SQL is useful when embedding queries in source code strings, passing SQL as API parameters or URL query strings, reducing query log verbosity, or storing queries in configuration files where readability is less important than compactness.
Does SQL minification change what the query does?
No. SQL parsers are whitespace-agnostic. Minified SQL is semantically identical to the original — the database will generate the same execution plan and return the same results.
Does the SQL minifier store my queries?
No. This tool runs entirely in your browser. Your SQL never leaves your machine — there are no server calls, no logging, and no data retention.
Will SQL comments be removed when I minify?
Yes. Both single-line (-- comment) and block (/* comment */) SQL comments are stripped during minification. If you need to keep comments, use the SQL Formatter tool instead.
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