SQL Minifier
Minify SQL by stripping comments and collapsing whitespace while preserving string literals and quoted identifiers exactly.
What is the SQL Minifier?
Minified SQL is compact for embedding in code, logs or configuration.
How does it work?
A small tokenizer walks the query, copying quoted strings unchanged, removing -- and /* */ comments, and reducing whitespace to single spaces.
Example
SELECT a -- id
FROM t WHERE x = 'a b' becomes SELECT a FROM t WHERE x = 'a b'.
Frequently asked questions
Is my data sent to a server?
No. This tool runs entirely in your browser; nothing you paste is uploaded or stored.
Is it safe for strings with -- inside?
Yes. Comment markers inside quotes are part of the string and are left alone.
Related tools
Enable JavaScript to use this calculator.