Skip to content
iyziTool

SQL Formatter

Paste any query and get it laid out with one clause per line, aligned indentation and uppercase keywords, or squeezed onto a single line. Pick the dialect for correct handling of its syntax.

Result
Paste a query to format it.

About this tool

Long queries written on one line, or copied from logs and ORMs, are hard to read and review. A formatter parses the SQL and rewrites it with each clause on its own line, nested subqueries indented, and keywords in a consistent case, without changing what the query does. This tool uses the open-source sql-formatter library with per-dialect grammars, so PostgreSQL casts, T-SQL brackets, MySQL backticks and BigQuery backtick paths are all understood.

Minify does the reverse: it removes comments and collapses whitespace outside string literals and quoted identifiers, which is handy for embedding a query in code or a URL. Formatting happens in your browser, so queries containing table names or data never leave your machine.

Frequently asked questions

Does formatting change the meaning of my query?
No. Only whitespace and keyword casing change. Identifiers, strings and values are kept exactly as written.
Which dialects are supported?
Standard SQL, MySQL, MariaDB, PostgreSQL, SQLite, SQL Server (T-SQL), Oracle PL/SQL, BigQuery, Snowflake, Redshift, Spark SQL and DuckDB.
Why does it report a parse error?
The query uses syntax the selected dialect does not know, or has unbalanced brackets or quotes. Try the matching dialect, or Standard SQL as a fallback.
Are my queries sent anywhere?
No. The formatter runs entirely in your browser.

Related tools