Developer & Text Tools
SQL Formatter
Format SQL for readability with dialect-aware rules for PostgreSQL, MySQL, SQLite, SQL Server, Oracle, BigQuery and more, or minify a query onto one line. Strings and comments are never changed.
Runs in your browserLive result
Workspace
Options
How to use this tool
- 1Paste one or more SQL statements.
- 2Pick the dialect, keyword case and indentation.
- 3Copy or download the formatted SQL.
Frequently asked questions
Standard SQL, PostgreSQL, MySQL, MariaDB, SQLite, SQL Server (T-SQL), Oracle PL/SQL, BigQuery, Snowflake and others. Choosing the right dialect helps with things like backtick identifiers and :: casts.
No. Only whitespace and keyword case change. String literals, quoted identifiers and comments are kept exactly; even text such as '-- not a comment' inside a string is left alone.
Yes. Minifying collapses whitespace and removes comments but keeps a space wherever removing it would join two tokens, such as "b - 1".
No. Everything runs in your browser with JavaScript. The text you paste is not uploaded, logged or stored by MuhammadLab.