Format messy SQL into readable, consistently indented queries with uppercase keywords, or minify it to a single compact line. It supports Standard SQL, PostgreSQL, MySQL, SQLite, SQL Server and BigQuery, and runs in your browser.
Input SQL
select u.id, u.name, count(o.id) as orders from users u left join orders o on o.user_id = u.id where u.active = true group by u.id, u.name order by orders desc limit 10;Beautified
SELECT
u.id,
u.name,
count(o.id) AS orders
FROM
users u
LEFT JOIN orders o ON o.user_id = u.id
WHERE
u.active = TRUE
GROUP BY
u.id,
u.name
ORDER BY
orders DESC
LIMIT
10;Same input
select u.id, u.name, count(o.id) as orders from users u left join orders o on o.user_id = u.id where u.active = true group by u.id, u.name order by orders desc limit 10;Minified
select u.id,u.name,count(o.id)as orders from users u left join orders o on o.user_id = u.id where u.active = true group by u.id,u.name order by orders desc limit 10;Generate tables with JSON to SQL, compare two queries with the text diff checker, or tidy other code with the JS and CSS formatters.
Paste your query into the input box and the formatted SQL appears instantly: keywords are uppercased and each clause goes on its own line with consistent indentation. Pick your database from the dropdown for dialect-specific syntax.
Standard SQL, PostgreSQL, MySQL, SQLite, SQL Server (T-SQL) and BigQuery. Choosing the right dialect makes sure dialect-specific operators and quoting are formatted correctly.
Yes. Switch to Minify to strip comments and collapse whitespace into a compact single-line query. String literals are left untouched. Everything runs in your browser — your code is never uploaded to a server.