← All Tools

SQL Query Formatter🔒 100% local

Beautify SQL queries. Privacy-first, no server uploads, no tracking.

Related Tools

Border Radius PreviewBox Shadow GeneratorCode Heatmap

Rewrites a query clause by clause: SELECT, ORDER BY and GROUP BY each get their columns on separate indented lines, WHERE and HAVING get their AND/OR conditions on their own lines, and the tool prints a header counting the clauses and selected columns. The scan tracks bracket depth and quoted strings, so a keyword inside a subquery or a literal is not mistaken for a clause boundary. It all runs locally.

How to use it

  1. Paste the query, or start from the default SELECT * FROM users WHERE id=1;.
  2. Press Process; the formatted query appears after a one-line summary of what was found.
  3. Check the column count on the summary line against what you expected the SELECT to return.
  4. Copy the block, remembering that the summary line and the trailing rules note are part of the output.

Worked example

SELECT id, name FROM users WHERE active=1 ORDER BY name;becomesFormatted 4 clause(s), 2 selected column(s). SELECT id, name FROM users WHERE active=1 ORDER BY name; Readability rules applied: one column per line, conditions on their own line, keywords uppercase.

The blank separator lines in the source are dropped by the final filter, so the summary line, the query and the rules note run together with no empty lines between them.

SELECT u.id FROM users u JOIN orders o ON o.uid=u.id WHERE u.active=1becomesFormatted 3 clause(s), 1 selected column(s). SELECT u.id FROM users u JOIN orders o ON o.uid=u.id WHERE u.active=1 Readability rules applied: one column per line, conditions on their own line, keywords uppercase.

JOIN is not a recognised clause here, so the join stays on the FROM line.

When to use it

What it does not do