How to use the SQL Formatter tool
- Paste your SQL query.
- Pick the dialect, keyword case and indentation.
- Click “Format” or “Minify” and copy the result.
Why format SQL
Queries copied from logs, ORMs or BI tools are often one long line. Formatting puts each clause (SELECT, FROM, JOIN, WHERE, GROUP BY) on its own line and indents subqueries, which makes reviews, debugging and diffs much easier.
Dialects
Choosing the right dialect helps the formatter understand special syntax, such as backtick identifiers in MySQL, :: casts in PostgreSQL, square brackets in SQL Server or QUALIFY in Snowflake and BigQuery. Formatting uses the open-source sql-formatter library.
Privacy
Everything runs in your browser. Your files and text are not uploaded to our server or stored anywhere. Queries can contain table names and data you would not want to share, so nothing is uploaded.
Frequently asked questions
Does formatting change what the query does?
No. Only whitespace and, if you choose, the case of keywords change. Strings and identifiers are kept exactly.
Can it format several statements?
Yes. Statements separated by semicolons are formatted one after another.
Does it validate my SQL?
It is a formatter, not a database. Obvious syntax problems may cause an error message, but it does not check table names or run the query.
What does minify do?
It removes comments and extra whitespace so the query fits on one line, for example in code or config files.