SQL Formatter
Format messy SQL into clean, readable queries for PostgreSQL, MySQL, SQL Server, SQLite, BigQuery and more. Free, no uploads.
Runs in your browser. Nothing you enter is uploaded
About SQL Formatter
Turn a long, one-line query from a log or an ORM into readable SQL: one clause per line, consistent indentation and keyword case. Choose your database's dialect so its own syntax is understood.
Formatting happens in your browser, so queries with table names, customer data or credentials never leave your device.
How to use SQL Formatter
- 1Paste your SQL, or open a .sql file.
- 2Choose the dialect, keyword case and indentation.
- 3Copy or download the formatted SQL.
Frequently asked questions
Which databases are supported?
Standard SQL, PostgreSQL, MySQL, MariaDB, SQLite, SQL Server (T-SQL), Oracle PL/SQL, BigQuery, Snowflake, Redshift, DuckDB, ClickHouse, Spark, Trino and Db2.
Does formatting change what the query does?
No. Only whitespace and, if you choose, the case of keywords change. Strings, identifiers and comments are kept.
Why does it show an error?
The formatter has to understand the query's structure. An error usually means a typo, a missing bracket, or syntax from another database: try choosing the right dialect.
Is my SQL sent anywhere?
No. It's formatted in your browser.