SQL Formatter

Keyword case
Indent
1 line · 0 B

SQL Formatter

Format SQL queries with readable indentation and syntax structure.

1 line · 0 B
UTF-8 · Standard SQL

About this SQL Formatter

Format SQL queries with readable indentation and syntax structure.

Your queries are processed locally in the browser. Nothing is uploaded or stored.

FAQ

Does formatting change what the query returns?

No. Formatting only changes whitespace and keyword casing — the formatted and original query parse to the same result.

Which SQL dialects are supported?

Standard SQL, MySQL, PostgreSQL, Transact-SQL, PL/SQL (Oracle), BigQuery, Snowflake, Redshift, ClickHouse, DuckDB, Hive, Spark, SQLite, Trino, MariaDB, TiDB, SingleStoreDB, N1QL (Couchbase), Db2, and Db2 for i — pick yours from the Dialect dropdown before formatting.

Why does LIMIT/TOP/FETCH FIRST look different across databases?

That's dialect syntax, not something formatting changes — PostgreSQL and MySQL use LIMIT, Transact-SQL uses TOP, standard SQL uses FETCH FIRST…ROWS ONLY. Pick the matching dialect before formatting.

Can it format invalid or incomplete SQL?

Mostly. The formatter tokenizes rather than fully validates, so incomplete fragments — a WHERE clause cut short, for example — still format fine. Genuinely malformed syntax throws a parse error with the line and column.

Does it work on multi-statement scripts and stored procedures?

Multi-statement scripts, yes — each statement is formatted and separated, and the status bar shows the count. Stored procedures format too, but deeply nested procedural logic inside BEGIN…END blocks isn't re-indented as a unit.

Is my SQL uploaded to a server?

No — everything runs client-side, which matters if your queries touch proprietary schemas or production data.

Related tools