SQL Formatter
Make long SQL queries readable again — clauses stacked, joins aligned, keywords normalised.
About this tool
Queries generated by ORMs or copy-pasted from logs are hard to reason about. This formatter puts
every major clause (SELECT, FROM, WHERE,
GROUP BY…) on its own line, indents sub-queries by parenthesis depth and aligns
AND / OR conditions so the logic of the query becomes visible.
How to use it
- Paste your SQL query, or click Sample.
- Choose how keywords should be cased (uppercase is the most common convention).
- Click Format SQL and copy the result.
Good to know
- String literals, quoted identifiers and comments are protected — their contents are never uppercased or re-flowed.
- The formatter targets common
SELECT,INSERT,UPDATEandDELETEsyntax. Highly dialect-specific constructs (window frames, JSON operators, stored-procedure bodies) may need manual touch-ups. - It does not parse or validate your SQL — it only reformats it.