SQL Query Minifier
Collapse a formatted SQL query onto fewer lines for logs, config or application code.
What is SQL Minifier?
The inverse of the SQL Formatter: it takes a readable multi-line query and produces the single-line form that fits in a log message, an environment variable or a string literal in code.
How it works
Whitespace outside string literals collapses to one space per run, punctuation is tightened against the token before it, and comments are removed unless you ask to keep them. Because the input is tokenized, a `--` inside a string is never mistaken for a comment.
- Paste the source. Drop in code, a stylesheet, a query or a selector list. Everything is read locally — the page never uploads what you paste.
- Choose the options. Indent width, quote style, keyword case or target browsers. The result updates as you change them, so you can see the effect immediately.
- Copy or download. Copy the result to the clipboard or download it as a file. Reset clears the form and returns every option to its default.
Examples
A minified bundle → readable code
Beautifying a 40 KB one-line stylesheet or script turns it into something reviewable, without altering a single token of the program itself.
A query moved between databases
MySQL's backticks, AUTO_INCREMENT and LIMIT 10, 20 become PostgreSQL's double quotes, identity columns and OFFSET — with a list of what still needs a human.
A stylesheet that only breaks in Safari
backdrop-filter, user-select and position: sticky need -webkit- prefixes for older Safari, which the CSS Autoprefixer adds for exactly the targets you tick.
Common mistakes
Expecting a formatter to fix invalid code
Formatting is whitespace and quoting. A missing brace, an unclosed tag or an unquoted variable survives the round trip and is reported instead — check the findings list.
Minifying without running the tests afterwards
Even a safe, non-mangling minifier can expose an existing automatic-semicolon-insertion bug. The JavaScript Minifier keeps the newlines that matter, but re-run your tests before shipping.
Treating a rewritten query as verified
The SQL Dialect Converter translates the syntax it can prove; data types, casts and function differences are listed for review, not guessed. Run the converted query against a real database.
Renaming or reformatting generated files
Regenerating a formatter's output is a no-op only if the formatter is the same one that produced it. Keep generated code out of the round trip and format the source it came from.
Frequently asked questions
Is the query still valid after minifying?
Yes. Only whitespace and comments are removed, and a space is kept wherever two tokens would otherwise merge (for example between a keyword and an identifier, or after a comma).
Where would I actually use the one-line form?
Logging a query so a slow-query report is searchable, storing a query in an environment variable, or pasting it into a driver call where the API takes a single string.
Should I minify queries I keep in the repository?
Usually not — a formatted query reviews far better in a diff. Minify at the edge (when logging or building) and keep the readable version in version control.