Free SQL Minifier
Collapse a formatted SQL query down to a single compact line by stripping comments and extra whitespace, entirely in your browser.
String literals in single quotes are left completely untouched, so text containing --, commas, or extra spaces inside a quoted value is never altered.
How to minify SQL
-
1
Paste your SQL
Paste a formatted or multi-line SQL query into the input box.
-
2
Click "Minify →"
Comments are stripped and whitespace is collapsed into a single compact line.
-
3
Copy the result
Click "Copy output" to grab the minified query for a config value, log line, or one-liner.
Example use cases
Pasting a query into a single-line field
Fit a multi-line query into a config value, environment variable, or command-line flag.
Logging a query compactly
Turn a formatted query into a one-line version that's easier to grep in logs.
Stripping comments before sharing
Remove internal notes from a query before pasting it somewhere outside the team.
Frequently asked questions
What does this minifier do?
It removes -- line comments and /* */ block comments, then collapses line breaks and repeated whitespace down to single spaces, producing a compact one-line query.
Will it touch text inside string literals?
No. Single-quoted string values are tracked separately and copied through exactly as written, so a value containing -- or extra spaces is never changed.
Does it validate or run my SQL?
No. This is a minifier only — it doesn't check your query against a database schema or execute it. Use the SQL Formatter if you want readable, indented SQL instead.
Is my SQL uploaded anywhere?
No. Minifying happens locally in your browser using JavaScript — nothing you paste is sent to a server.