← All Tools
SQL Minifier Formatter🔒 100% local
Minify SQL. Privacy-first, no server uploads, no tracking.
Reduces a SQL statement to a single compact line. It removes -- line comments and /* */ block comments first, collapses every run of whitespace to one space, deletes the spaces around punctuation and operators, and upper-cases a fixed list of keywords. The work happens entirely in the page.
How to use it
- Paste the statement, or keep the default SELECT * FROM users WHERE id=1; that is already there.
- Press Process to get the minified statement in the Output panel.
- Press Copy Output, then paste it wherever the space matters.
Worked example
SELECT * FROM users WHERE id = 1; -- xbecomesSELECT*FROM users WHERE id=1;The trailing comment is dropped and the operators lose their surrounding spaces, so the star is welded to its neighbours.
SELECT /* x */ 1 FROM tbecomesSELECT 1 FROM tA block comment is replaced by a single space rather than removed outright, so a space remains between the two words around it.
When to use it
- Shrinking a query before embedding it in a JSON fixture or a one-line config value.
- Stripping comments out of a query copied from someone else's migration file.
- Comparing two statements where the only difference is whitespace.
What it does not do
- Comment detection is character-based, not string-aware. SELECT 'a--b' FROM t is cut down to SELECT 'a, because the -- inside the quotes is treated as the start of a comment.
- Operators lose their spaces, so a - -b becomes a--b, which several SQL engines read as the start of a comment. Check negated expressions after minifying.
- Keyword case is forced only for the fixed list the tool carries (SELECT, FROM, WHERE, AS, AND, OR and about fifteen more); anything else keeps the case you typed.
- It does not parse or validate anything, and a multi-statement script is squeezed onto one line with its semicolons still in place.