SQL Minifier

Collapse whitespace in SQL to remove blank lines and padding, keeping string literals intact so the query still runs exactly the same way as before.

An SQL minifier collapses whitespace between tokens and removes optional comments, producing a single-line query. Quoted strings and identifiers are tokenised first so their contents stay intact.

Output

                

Paste or type something above.

Questions about sql minifier

Is a single-line query still valid?
Yes. SQL does not need newlines. Only comments and the final semicolon are removed.
Will comments inside strings be removed?
No. Anything inside single quotes, double quotes, or backticks is copied through unchanged.
Should I run the minified query?
Yes, it is the same query. Keep a readable copy for review, since minified SQL is harder to debug.