Mode
Keywords
Indent
SQL
Result
Results appear as you typeShortcut: Ctrl + Enter to run

How to use the SQL Formatter

  1. Paste SQL on the left, or press "Sample" to load a query with a JOIN.
  2. Choose Beautify or Minify, keyword case and indentation.
  3. The result appears instantly; the status bar warns about unbalanced parentheses.
  4. Press "Copy" or "Download" to save a .sql file.

Examples

Format a JOIN with conditions

Input
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
Output
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

StatementsSELECT, INSERT, UPDATE, DELETE, WITH, all JOIN types, subqueries, CASE, UNION
LayoutClauses on new lines, one column per line, AND / OR split, indented subqueries
OptionsBeautify / minify, keyword UPPER / lower / keep, 2 or 4 spaces
PreservedStrings, quoted identifiers and comments
Not includedFull syntax validation or execution
ProcessingIn 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.