Compress SQL onto a single line: comments are stripped and every run of whitespace collapses to one space, while the contents of string and quoted-identifier literals are left untouched. Useful for embedding a query in a config value, a log line or a one-line shell command. It all happens in your browser — nothing is uploaded.
A ten-line query with two comments, minified. Same query, same result — 178 characters instead of 258, a 31% saving, and it pastes into a single config field.
original
SELECTu.id,u.email,-- primary contactcount(o.id)ASordersFROMusersu/* only paying customers */JOINordersoONo.user_id=u.idWHEREu.active=trueANDu.country='US'GROUPBYu.id,u.emailORDERBYordersDESC;
The minifier is a tokenizer, not a regex sweep — it knows when it’s inside a literal, so it never touches your data.
Removed
Line comments
Everything from -- to the end of the line is removed. This is what makes one-lining safe: a surviving -- comment would swallow the rest of the query.
Block comments
/* … */ is removed wherever it appears, including mid-expression.
Newlines, tabs and indentation
Every run of whitespace between tokens collapses to a single space.
Preserved byte for byte
String literals
Whitespace inside '…' is untouched: a value padded with two spaces keeps both, newlines inside a literal survive, and doubled '' escaped quotes are passed through as they are.
Quoted identifiers
"column name" and `column name` keep their internal spacing, so quoted names still resolve.
A single space between tokens
Tokens are separated by one space rather than glued together. The output is a couple of bytes longer than it strictly needs to be, and never ambiguous.
When one line is the right shape
Config values and env vars
A query in a YAML, JSON or .env value has to be one line. Minify, paste, done.
Shell and CLI one-liners
psql -c "…" and mysql -e "…" take a single argument; a multi-line query needs quoting gymnastics.
Log lines and bug reports
One line per query keeps grep and log aggregation usable.
Diff noise
Comparing two queries that differ only in indentation is easier once both are minified — real differences are the only ones left.
Gotchas
Comments are gone for good
Minifying is reversible — reformatting restores the layout — but stripped comments can’t come back. Minify a copy, keep the commented original in source control.
Hand-joining lines breaks queries
Deleting newlines yourself is what makes a -- comment eat the rest of the query. That’s exactly the case the minifier handles by removing comments first.
Minified SQL isn’t faster
The database parses either form in microseconds. You minify for the transport — a config field, a CLI argument, a log line — not for query performance.
Frequently asked questions
Is the SQL minifier free?
Yes. It's free, needs no account and has no usage limit. Minification runs entirely in your browser.
Is my SQL uploaded anywhere?
No. The query is processed client-side. Nothing leaves your machine and nothing is stored.
Does minifying change what the query does?
No. Only comments and formatting whitespace are removed — string literals and quoted identifiers are preserved byte for byte, so the query is semantically identical.
Can I get the formatted query back?
Yes. Minifying is reversible: paste the one-liner into the formatter and it expands back into indented SQL. Only the comments are gone for good.
How much smaller does SQL get?
Typically 20–40% for hand-written, indented SQL, and more when the query carries comments. The badge above the output shows the exact saving for your query.
Minify vs. beautify
They’re opposites: the minifier crushes a query to one line for machines, the formatter expands it back into indented, readable SQL for humans. Round-tripping is safe — minify to embed, then paste into the formatter to read it again. If a minified query stops working, check it in the SQL validator first: a parse error tells you the problem is syntax, not the database.