What the SQL formatter does
It parses your query and rewrites it with one clause per line (SELECT, FROM, JOIN, WHERE, GROUP BY…), indented column lists and subqueries, and consistent keyword case. The meaning of the query does not change.
Supported databases
Standard SQL, PostgreSQL, MySQL, MariaDB, SQLite, SQL Server (T-SQL), Oracle PL/SQL, BigQuery, Snowflake, Redshift, Spark SQL, DuckDB, ClickHouse and Trino. Choosing the right dialect matters for things like [brackets] in T-SQL, backticks in MySQL and BigQuery, and $1 parameters in PostgreSQL.
Minify
Minify removes comments and collapses whitespace onto one line, leaving string literals and quoted names untouched (including backslash escapes in MySQL-style dialects and $$ strings in PostgreSQL). It is handy for pasting a query into code or a log search.
Formatting uses the open-source sql-formatter library, running in your browser.