Format and minify SQL queries with dialect support.
The SQL Formatter reformats or minifies SQL queries with dialect support for standard SQL, MySQL, PostgreSQL, SQLite, T-SQL, Oracle and BigQuery. You choose indentation and whether keywords are uppercase, lowercase or preserved. It helps developers read machine-generated queries and keep code reviews tidy.
SQL formatting rearranges a query into a consistent layout, with clauses such as SELECT, FROM, WHERE and ORDER BY on their own lines, columns listed one per line and joins indented. The meaning of the query does not change; only whitespace and, optionally, the case of keywords. Different databases use different syntax, for example quoting identifiers with backticks in MySQL, square brackets in T-SQL or double quotes in PostgreSQL, so a formatter needs to know the dialect to tokenize correctly. Minifying does the opposite: it removes comments and collapses whitespace.
No. Only whitespace and, if you choose, keyword case change. String literals and quoted identifiers are left alone.
Dialects differ in quoting, operators and functions. Choosing the right one lets the formatter tokenize those correctly instead of failing.
Yes, both -- line comments and /* */ block comments are removed, and whitespace outside quotes is collapsed.
Yes. Multiple statements separated by semicolons are formatted together.
No. It only checks syntax well enough to format; it does not know your tables or run the query.