← All Tools
SQL Query Formatter🔒 100% local
Beautify SQL queries. Privacy-first, no server uploads, no tracking.
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
- Paste the query, or start from the default SELECT * FROM users WHERE id=1;.
- Press Process; the formatted query appears after a one-line summary of what was found.
- Check the column count on the summary line against what you expected the SELECT to return.
- 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
- Reviewing a generated query whose join predicates have been crammed onto one line.
- Confirming how many columns a SELECT really returns before it reaches a database.
- Showing someone clause order by laying the query out clause by clause.
What it does not do
- Against the sql-formatter tool on this site, this one ignores keywords inside brackets and quoted strings and adds the clause and column summary, but it does not place JOIN, ON or UNION on lines of their own.
- The depth-aware scan knows nothing about comments, so a -- comment containing the word FROM is still broken as if it were a clause: SELECT 1 -- FROM x becomes SELECT / 1 -- / FROM x.
- Statements containing none of the fifteen recognised keywords raise 'No SQL clause keywords found (SELECT, FROM, WHERE...).'
- Only single and double quotes count as string delimiters; backtick-quoted identifiers are scanned as ordinary text.