How to use the SQL Formatter
- Paste SQL on the left, or press "Sample" to load a query with a JOIN.
- Choose Beautify or Minify, keyword case and indentation.
- The result appears instantly; the status bar warns about unbalanced parentheses.
- Press "Copy" or "Download" to save a .sql file.
Examples
Format a JOIN with conditions
select u.id, count(o.id) as orders from users u left join orders o on o.user_id = u.id where u.active = 1 and o.status = 'paid' group by u.id
SELECT
u.id,
COUNT(o.id) AS orders
FROM
users u
LEFT JOIN orders o
ON o.user_id = u.id
WHERE
u.active = 1
AND o.status = 'paid'
GROUP BY
u.id
Specs & key facts
| Statements | SELECT, INSERT, UPDATE, DELETE, WITH, all JOIN types, subqueries, CASE, UNION |
|---|---|
| Layout | Clauses on new lines, one column per line, AND / OR split, indented subqueries |
| Options | Beautify / minify, keyword UPPER / lower / keep, 2 or 4 spaces |
| Preserved | Strings, quoted identifiers and comments |
| Not included | Full syntax validation or execution |
| Processing | In your browser (queries are never uploaded) |
FAQ
Does it validate SQL syntax?
Not fully — it warns about unclosed quotes and unbalanced parentheses. Run the query against your database to confirm it is valid.
Which databases are supported?
Common syntax for MySQL, MariaDB, PostgreSQL, SQLite and SQL Server formats well; vendor-specific syntax is kept as-is.
Can formatting change my query's results?
No. Only whitespace, line breaks and keyword case change; strings and identifiers stay exactly the same.
Is it safe to paste production queries?
Yes. Formatting runs entirely in your browser and nothing is sent to a server.