What this does
This collapses SQL onto a single line: every run of whitespace (newlines, indentation, repeated spaces) becomes a single space, and comments are removed entirely. It's the inverse of SQL Formatter — useful when you need to embed a query as a one-liner in code, an environment variable, a log line, or a config file, rather than the multi-line layout you'd want while writing or reviewing it.
Why comments are always removed
Line comments (-- like this) run to the end of the physical line they're on — there's no closing delimiter. Collapse everything onto one line without removing them first, and a line comment would silently swallow the rest of the query, breaking it. Block comments (/* like this */) don't have that specific problem, but stripping them too is what most people actually want from "minify." Both are removed unconditionally here — there's no toggle to keep them, since keeping line comments specifically isn't safe to do automatically.
What's preserved
Single spaces are kept around keywords, identifiers, and operators — the output stays immediately readable and pastes into any SQL client without looking mangled. Only the genuinely redundant whitespace goes: the space after (, before ), and around . in qualified names, none of which change how the query reads.
How this is computed
Minifying happens entirely in your browser via a small hand-written tokenizer, the same approach behind SQL Formatter — your SQL is never sent anywhere.