Format and beautify SQL statements, multi-dialect support
SQL is forgiving about whitespace, which means people produce one-line monstrosities that are unreadable until formatted. A good formatter aligns keywords (SELECT, FROM, WHERE), indents subqueries and JOINs consistently, and turns 200-character lines into something humans can review.
This formatter supports multiple SQL dialects (Standard, MySQL, PostgreSQL, SQL Server, SQLite, BigQuery, etc.) so dialect-specific keywords like LIMIT vs TOP are kept on the right side. Configurable indent (2 spaces, 4 spaces, or tabs) and runs entirely in your browser.
select u.id,u.name,p.title from users u left join posts p on p.user_id=u.id where u.active=1 order by u.id desc limit 10;SELECT
u.id,
u.name,
p.title
FROM
users u
LEFT JOIN posts p ON p.user_id = u.id
WHERE
u.active = 1
ORDER BY
u.id DESC
LIMIT
10;Standard SQL, MySQL, PostgreSQL, SQL Server (T-SQL), SQLite, BigQuery, and a few more. The dialect mainly affects keyword recognition and a few syntax variants (e.g., MySQL backticks vs PostgreSQL double quotes for identifiers).
It only changes whitespace and case of keywords (configurable). It never re-orders clauses or rewrites expressions, so the formatted SQL produces identical results. As always, test before applying to production.
Yes — each statement is formatted independently. Semicolons are preserved.
Both -- single-line and /* multi-line */ comments are preserved in their original positions. Inline comments stay inline; standalone comments stay on their own lines.
No. The formatter parses well enough to format but doesn't check whether the query is logically valid (table names exist, column types match, etc.). Run EXPLAIN in your database for that.