Format an SQL query
You copied an SQL query auto-generated by an ORM or pulled from a database admin tool, and it's all on one unreadable line? Paste it here to get a version with keywords in uppercase and each main clause on its own line.
Warning : this is a basic keyword-recognition formatter, not a real SQL parser like sqlformat. It doesn't specifically understand subqueries or CTEs (no dedicated indentation for them), and only covers the most common SQL dialects.
How it works
Paste your SQL query into the field above and click "Format": common keywords (SELECT, FROM, WHERE, JOIN and its variants, GROUP BY, ORDER BY, INSERT INTO, VALUES, UPDATE, SET, DELETE, AND, OR, LIMIT) are uppercased, and each main clause starts on its own line so the structure of the query is visible at a glance. The content of string literals (between single quotes) and double-quoted identifiers is never modified.
Are queries generated by an ORM (Django, Prisma, Hibernate...) handled well?
In the vast majority of cases yes : these queries use standard SQL syntax that the tool recognizes well. For very complex queries with multiple nested subqueries, the indentation won't visually distinguish subquery levels, but the reformatted query remains readable and correct.
Can formatting change the result of my query?
No. Only the presentation (uppercase keywords, line breaks) is changed. Table names, column names, values, and query logic remain strictly identical.
Formatting runs 100% locally in your browser via WebAssembly : your SQL query is never sent to a server.