Paste your SQL
Paste one or more statements, or load a .sql file. Nothing is run or uploaded.
Developer Tools
Format and beautify SQL for PostgreSQL, MySQL, SQL Server, Oracle, SQLite, BigQuery, and more.
Turn a dense one-line query into readable, indented SQL for the database you use, entirely in your browser. Need to compare two versions of a query? Use Text Diff.
How it works
Paste one or more statements, or load a .sql file. Nothing is run or uploaded.
Choose your database, keyword case, indentation and where AND / OR go.
Copy the formatted SQL or download it as a .sql file.
Use cases
Expand a query copied from an application log or an ORM into something you can follow.
Apply one consistent style so reviews focus on what the query does, not how it is spaced.
Format examples with consistent keyword case and indentation before pasting them into docs.
FAQ
No. Formatting happens in your browser and the query is never run against any database.
It should only change spacing, line breaks and, if you choose, the case of keywords. The tool checks this and shows a warning if the output differs in any other way. String literals and comments are kept exactly as written.
Standard SQL plus PostgreSQL, MySQL, MariaDB, SQLite, SQL Server (T-SQL), Oracle (PL/SQL), BigQuery, Snowflake, Redshift, Spark, Hive, Trino, Db2, DuckDB and ClickHouse. Choosing the right dialect matters for vendor-specific syntax.
The formatter has to understand the syntax. Vendor-specific features usually need the matching dialect selected. The message shows the line and column where it stopped.
It does not validate against a schema or database, and it does not minify: collapsing whitespace can change the meaning of queries that contain comments or strings.
Related Tools