SQL Formatter
Format SQL queries across dialects: standard SQL, MySQL, PostgreSQL, SQLite, BigQuery.
FormatMulti-dialectClient-sideUnlimited
Dialect
Keywords
Indent
0 / 500,000
Try It Out
Experience the benefits of our SQL Formatter by trying out these sample queries. Click on any example to load it into the tool and see the formatted result.
How to use
- Paste your SQL. Any query, SELECT, INSERT, DDL, anything.
- Pick a dialect. Standard, MySQL, PostgreSQL, SQLite, or BigQuery.
- Copy the formatted query. Readable, indented SQL.
Common use cases
- Reading auto-generated ORM queries
- Cleaning up analytics SQL snippets
- Learning SQL by seeing readable queries
- Removing comments before sharing a query in a ticket
Frequently asked questions
- Which SQL dialects are supported?
- Standard SQL plus MySQL, PostgreSQL, SQLite, and BigQuery. Pick a dialect to get the right keyword list and quoting rules. The formatter is built on the sql-formatter library, which is dialect-aware for spacing, quoting, and identifier rules.
- Can I keep my keyword case as I wrote it?
- Yes. The Keywords toggle has three modes: UPPER (force keywords to uppercase), lower (force lowercase), and Preserve (leave casing untouched). Useful when your team has a house style.
- What does Tabular indent style mean?
- Tabular indentation aligns SELECT clauses, JOINs, and WHERE conditions in a vertical column for at-a-glance scanning, similar to the style used in classic SQL training material. Tabular-L left-aligns keywords; Tabular-R right-aligns them.
- Does the formatter handle multi-statement scripts?
- Yes. Statements separated by semicolons are formatted individually, so you can paste a full migration or seed file and get back consistently indented output.
- Are SQL comments preserved?
- Yes. Both line comments (--) and block comments (/* */) are preserved by the formatter. Toggle Remove comments to strip them entirely if you need clean output for a screenshot or ticket.
- Can I minify SQL with this tool?
- Yes. Toggle Minify to collapse whitespace into a single line. Useful for embedding queries in code, env vars, or single-line log messages without changing what the query does.
- Does my SQL get sent to a server?
- No. Formatting runs in your browser via the sql-formatter library, so sensitive queries stay on your device.
Related tools
How to use
- Paste your SQL. Any query, SELECT, INSERT, DDL, anything.
- Pick a dialect. Standard, MySQL, PostgreSQL, SQLite, or BigQuery.
- Copy the formatted query. Readable, indented SQL.
Common use cases
- Reading auto-generated ORM queries
- Cleaning up analytics SQL snippets
- Learning SQL by seeing readable queries
- Removing comments before sharing a query in a ticket
Frequently asked questions
- Which SQL dialects are supported?
- Standard SQL plus MySQL, PostgreSQL, SQLite, and BigQuery. Pick a dialect to get the right keyword list and quoting rules. The formatter is built on the sql-formatter library, which is dialect-aware for spacing, quoting, and identifier rules.
- Can I keep my keyword case as I wrote it?
- Yes. The Keywords toggle has three modes: UPPER (force keywords to uppercase), lower (force lowercase), and Preserve (leave casing untouched). Useful when your team has a house style.
- What does Tabular indent style mean?
- Tabular indentation aligns SELECT clauses, JOINs, and WHERE conditions in a vertical column for at-a-glance scanning, similar to the style used in classic SQL training material. Tabular-L left-aligns keywords; Tabular-R right-aligns them.
- Does the formatter handle multi-statement scripts?
- Yes. Statements separated by semicolons are formatted individually, so you can paste a full migration or seed file and get back consistently indented output.
- Are SQL comments preserved?
- Yes. Both line comments (--) and block comments (/* */) are preserved by the formatter. Toggle Remove comments to strip them entirely if you need clean output for a screenshot or ticket.
- Can I minify SQL with this tool?
- Yes. Toggle Minify to collapse whitespace into a single line. Useful for embedding queries in code, env vars, or single-line log messages without changing what the query does.
- Does my SQL get sent to a server?
- No. Formatting runs in your browser via the sql-formatter library, so sensitive queries stay on your device.