SQL Formatter

Turn dense SQL into a query you can actually read.

How the SQL formatter works

Queries written quickly — in logs, ORMs or someone else's migration — tend to be one long line where the important clauses are invisible. This formatter puts each major clause on its own line, indents the details under it, uppercases keywords and aligns JOIN conditions so the shape of the query is obvious at a glance.

It handles SELECT / INSERT / UPDATE / DELETE statements with their common clauses: FROM, JOIN chains, WHERE, GROUP BY, HAVING, ORDER BY, LIMIT, and comma-separated column lists that wrap neatly.

Formatting only changes whitespace and keyword case — never the query's meaning — so the output is safe to run and safe to commit alongside your code for review.

FAQ

Does it work with any SQL dialect?

It covers the common core of MySQL, PostgreSQL and SQLite syntax. Dialect-specific features (window function syntax, JSON operators) pass through as-is; they format acceptably even if not specially aligned.

Can it format multiple statements?

Yes — statements separated by semicolons are formatted one after another with a blank line between them.

Is my query sent to a server?

No. All formatting runs in your browser, so queries containing table names or business logic stay on your machine.