How it works
Each major clause (SELECT, FROM, WHERE, GROUP BY, ORDER BY, HAVING, LIMIT, OFFSET, joins) starts a new line | Keywords are rewritten in the chosen case — upper by default, lower or as-written on request | Identifiers, numbers, quoted strings and quoted identifiers are copied exactly, never re-cased or re-spaced inside
Paste a query — the one-line tangle copied out of an application log is the usual case — and the formatter re-lays it out by clause: SELECT, FROM, WHERE, each JOIN, GROUP BY, ORDER BY and LIMIT each start their own line, keywords take the case you choose, and indentation follows the structure. The query is tokenised rather than blindly split on spaces, which is what keeps the dangerous parts safe: a string literal like 'O Neil' is one token and passes through untouched, dotted identifiers like a.id stay joined, and a keyword appearing inside a literal is never mistaken for a clause.
Be precise about what this tool is and is not. It is a layout tool: it changes whitespace and keyword case, and it will faithfully reformat a query that references tables which do not exist or columns nobody defined — it never connects to a database, never executes anything, and does not promise that a reformatted query is syntactically valid for your dialect. Dialects genuinely differ (TOP in SQL Server, LIMIT in PostgreSQL and MySQL, backtick quoting in MySQL), and a layout that suits all of them is a layout that commits to none; check the result against your own engine before it ships.
The working habit this page supports is review: a clause-per-line query is one a colleague can actually read in a pull request, and one whose JOIN conditions and WHERE filters can be checked line by line instead of excavated from a paragraph. Paste queries stay in your browser — nothing is uploaded, which matters when the query embeds real names, emails or account numbers in its literals.