SQL formatter and beautifier

Runs locally

Pretty-print or minify queries across 11 dialects.

Query

Formatted

Formatted SQL will appear here…

About the SQL formatter

How it works in 4 steps · 4 common use cases · 3 questions answered

How it works

  1. 1.Paste a query — a single statement or a whole script.
  2. 2.Pick the dialect so that keywords, functions and quoting rules match your database.
  3. 3.Choose keyword casing, then read the formatted query on the right.
  4. 4.Or minify instead, to collapse a formatted query back to one line.

Common use cases

  • •Making a one-line query pulled from an application log readable
  • •Formatting a generated query consistently before committing it to a migration
  • •Reading someone else’s deeply nested CTE without counting parentheses by hand
  • •Minifying a query to embed it in a config file or a shell command

FAQ

Which dialects are supported?

PostgreSQL, MySQL, MariaDB, SQLite, SQL Server (T-SQL), Oracle PL/SQL, BigQuery, Snowflake, Redshift, Spark SQL and a generic standard-SQL mode.

Will formatting change what my query does?

No. Formatting only alters whitespace, line breaks and keyword casing. String literals and quoted identifiers are left exactly as written.

Does the minifier remove comments?

Yes — it strips comments and collapses whitespace, while leaving whitespace inside string literals untouched.