SQL Formatter

Beautify SQL for MySQL, PostgreSQL, SQLite, T-SQL and BigQuery.

Paste any SQL query and get a properly indented, keyword-uppercased version. Select your dialect (MySQL, PostgreSQL, SQLite, T-SQL, BigQuery) and indent width. Powered by sql-formatter; runs entirely in the browser.

Common use cases

  • Make minified ORM-generated SQL readable for debugging
  • Standardise team SQL style with uppercase keywords and consistent indent
  • Format pasted query plans before sharing in pull request reviews
  • Tidy up complex JOINs and subqueries before optimising

Frequently asked questions

Does it modify my query?
It only re-indents and adjusts keyword case. The semantics, table names and values stay the same.
Which dialects are supported?
Standard SQL, MySQL, PostgreSQL, SQLite, T-SQL (MSSQL) and BigQuery. Each handles dialect-specific keywords and quoting differently.
Can it format Snowflake or DuckDB?
These dialects share enough syntax with PostgreSQL that the postgresql option produces good results in most cases.

Related tools