Your SQL never leaves your browser. No server, no logging, no account.
Format and prettify SQL queries -- free, private, runs entirely in your browser
Your SQL never leaves your browser. No server, no logging, no account.
Read more: SQL Formatter
Raw SQL written under deadline pressure or copied from logs is often a wall of text with inconsistent casing, no indentation, and keywords crammed onto the same line as their clauses. Formatted SQL is dramatically easier to read, debug, and maintain.
There is no single standard, but these conventions are widely followed and what this tool applies:
SELECT, FROM, WHERE) and table/column names in lowercase or mixed case. This visually separates language constructs from data identifiers.SELECT, FROM, WHERE, GROUP BY, ORDER BY, HAVING, LIMIT starts on a new line.ON clause and joined table are indented relative to the JOIN keyword.WHERE and HAVING start on their own indented line for easy scanning.Example -- unformatted:
select u.id,u.name,o.total from users u join orders o on u.id=o.user_id where o.total>100 and u.active=1 order by o.total desc limit 10
Example -- formatted:
SELECT
u.id,
u.name,
o.total
FROM users u
JOIN orders o
ON u.id = o.user_id
WHERE o.total > 100
AND u.active = 1
ORDER BY o.total DESC
LIMIT 10
This formatter handles the most common SQL constructs found in application code and data work:
No. The formatter only adjusts whitespace, indentation, and keyword casing. It does not parse the SQL grammar or check for syntax errors. If your query has a typo or a missing parenthesis, it will be formatted as-is without any warning about the syntax problem.
The tool supports Standard SQL and extends keyword recognition for MySQL and PostgreSQL when you select those dialects. The dialect setting primarily affects which words are treated as keywords for highlighting and casing -- the core formatting logic (clause placement, indentation) is the same across all three.
No. All formatting runs in JavaScript directly in your browser tab. Your SQL query never leaves your machine. There is no backend server processing your queries, no usage logging, and no account required.