Text · SQL

SQL Formatter

Paste messy SQL and get it cleanly indented and consistently cased, for Postgres, MySQL, SQLite, T-SQL and more. Formats in your browser; nothing is uploaded.

SQL in
Formatted

Readable SQL in one paste

Long queries arrive as one unbroken line from a log or an ORM and are miserable to read. This formatter re-indents the query, clauses on their own lines, joins and conditions aligned, lists broken out, and normalizes keyword casing so select and SELECT stop coexisting in the same file. It’s built on a real SQL tokenizer, so it understands subqueries, CTEs, window functions, and dialect-specific syntax rather than just inserting newlines.

Pick your dialect

SQL isn’t one language. Choosing PostgreSQL, MySQL, T-SQL, BigQuery, Snowflake, and the rest tells the formatter which keywords and operators are valid so it lays your query out correctly instead of mangling dialect-specific syntax.

FAQ

Does it change what my query does?

No, formatting only adds whitespace and adjusts keyword case. The query’s logic and identifiers are untouched.

Which dialects are supported?

Standard SQL plus PostgreSQL, MySQL, MariaDB, SQLite, T-SQL, Oracle PL/SQL, BigQuery, Snowflake, and Spark.

Is my SQL uploaded?

No. Formatting runs in your browser, so queries with real table and column names stay local and it works offline.

Related

Turning rows into objects? CSV ⇄ JSON. Naming columns consistently? The case converter.