TurantToolsdev</> All tools

// free ยท runs in your browser ยท nothing uploaded

SQL Formatter & Beautifier

Free SQL formatter: puts SELECT, FROM, JOIN, WHERE and GROUP BY on their own lines, one column per line, indents AND/OR and subqueries, uppercases keywords, or minifies the query. Works for MySQL, PostgreSQL, SQLite and SQL Server.

Result

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
  AND o.created_at >= '2026-01-01'
GROUP BY u.id,
  u.name
HAVING COUNT(o.id) > 2
ORDER BY orders DESC
LIMIT 10;

Puts each clause (SELECT, FROM, JOIN, WHERE, GROUP BYโ€ฆ) on its own line, one column per line and AND/OR indented; subqueries are indented too. Strings and comments are left exactly as written. Works for MySQL, PostgreSQL, SQLite and SQL Server queries. It only changes layout; it doesn't check that the SQL is valid. Runs in your browser.

๐Ÿ’ฌ Share this tool

๐Ÿ› ๏ธ Spotted a mistake or an out-of-date rule? Tell us

Related tools

Questions people ask

Does the formatter change what my query does?+

No. It only changes spaces and line breaks (and keyword case if you choose). Strings and comments stay exactly as written.

Does it check my SQL for errors?+

No. It formats the layout only; run the query in your database to check it.

More free tools