SQL Formatter
Format SQL for Postgres, MySQL, BigQuery, Snowflake + 13 more dialects. Configurable keyword case and width.
published
- [FREE]
- [NO_SIGNUP]
- [NO_UPLOAD]
A SQL formatter rewrites a query with consistent indentation, keyword case, and line breaks. Useful for code review, EXPLAIN output, and embedding queries in source code that someone else has to read.
Privacy
The formatter (sql-formatter, MIT) runs entirely in your browser. SQL is never sent to a server.
Frequently asked questions
Why use a SQL formatter?
Long ORM-generated queries are unreadable on one line. Formatting splits clauses across lines and indents subqueries, making it possible to read what the query is actually doing — necessary before a code review or an EXPLAIN ANALYZE.
Which SQL dialects are supported?
Postgres, MySQL, MariaDB, SQLite, T-SQL (SQL Server), BigQuery, Redshift, Snowflake, Spark SQL, DuckDB, Trino, Db2, PL/SQL (Oracle), Hive, N1QL, SingleStore, and a generic ANSI SQL mode.
Will it change my query semantics?
No. The formatter only inserts whitespace and reshapes case. Identifiers, literals, operators, and order are unchanged.
Does it minify too?
Yes — click "minify" to collapse to a single line. Useful for embedding in code or comparing against logs.
Is my SQL uploaded?
No. The `sql-formatter` library runs in your browser. Your queries — and any sensitive table or column names — never leave your tab.