SQL Formatter
Paste a query that arrived as one long line and get it back with clauses on their own lines and consistent keyword casing. Particularly useful for the machine-generated SQL that ORMs log.
Runs entirely in your browser. Nothing you paste is uploaded.
Formatted SQL will appear here...
About the SQL Formatter
Formatting puts each major clause — SELECT, FROM, WHERE, JOIN, GROUP BY, HAVING, ORDER BY — on its own line, which makes the shape of a query visible at a glance. On a long ORM-generated statement this is often the difference between understanding it and not.
The formatter is deliberately conservative: it does not rewrite your query, reorder clauses, or change semantics. Comments and string literals are preserved as-is, including any keywords that happen to appear inside them.
Frequently asked questions
Which SQL dialects are supported?
Formatting is dialect-agnostic and works with standard SQL keywords, so PostgreSQL, MySQL, SQLite and SQL Server queries all format sensibly.
Will formatting change what my query does?
No. Only whitespace and keyword casing change. String literals and comments are left exactly as written.
Is my query sent to a server?
No. Formatting happens in your browser, so queries containing real table names or embedded values stay on your machine.