How to use SQL Formatter
- 1Paste SQL or open a .sql file.
- 2Pick your dialect, keyword case and indent.
- 3Copy or download the formatted .sql.
What it does
- 14 SQL dialects
- UPPER, lower or keep keyword case
- 2 / 4 spaces or tabs
- Minify to compact SQL
- Syntax errors with line & column
FAQ
- Why does the dialect matter?
- Each database has its own syntax: backtick identifiers in MySQL, [brackets] and TOP in SQL Server, :: casts and $$ strings in PostgreSQL, STRUCT and backtick table paths in BigQuery. Picking the right dialect lets the formatter understand those parts instead of reporting a syntax error.
- Does formatting change what my query does?
- No. Only whitespace, line breaks and the case of keywords change. String literals, quoted identifiers and comments are kept exactly. Minify also removes comments (except MySQL /*! */ and optimizer hints).

