Tools / SQL Formatter
SQL Formatter
Paste SQL on the left, get a formatted version on the right. Pick your dialect, tab width, and keyword case.
How to use SQL Formatter
Paste or drop SQL
Paste a query into the left pane, or click Load file to open a .sql file from disk. Multiple queries separated by semicolons are supported.
Pick the dialect
Standard SQL is a safe default. Pick a specific dialect (PostgreSQL, MySQL, SQLite, BigQuery, Snowflake, Redshift, SQL Server, Db2, Oracle PL/SQL, Spark, Trino, ClickHouse, DuckDB, MariaDB) to handle dialect-specific keywords and syntax correctly.
Configure style
Choose keyword case (UPPER, lower, or preserve) and indentation (2 spaces, 4 spaces, or tab). The output updates live as you change options.
Read the formatted output
The right pane shows the re-indented, re-wrapped SQL. Keywords align by clause, SELECT list items stack one per line for diffability.
Copy or download
Use the Copy button on the output pane to put the result on your clipboard, or click Download .sql to save it to a file.
Frequently asked questions
Related tools
Generate SQL INSERT statements from a JSON array. Supports batched and per-row modes.
Format, minify, or validate JSON with configurable indentation and error reporting.
Format, validate, or canonicalize YAML with configurable indentation and line:column error reporting.