Skip to content
MixTool

SQL formatter

Turn long, single-line SQL into a clearly structured query, with the right rules for your database's dialect.

  • Runs entirely in your browser
  • Free · no sign-up
  • Works on phone and desktop
Loading tool…

Queries you can read at a glance

Paste a query from an ORM log, a BI tool or a teammate's message and the formatter puts each clause — SELECT, FROM, JOIN, WHERE, GROUP BY — on its own line, indents column lists, joins and subqueries, and lines up conditions so the logic is easy to follow.

Choose your dialect (standard SQL, MySQL, MariaDB, PostgreSQL, SQLite, SQL Server T-SQL, Oracle PL/SQL, BigQuery, Snowflake or Redshift) so vendor-specific syntax is recognized, and set keywords to UPPERCASE, lowercase or leave them as written.

How to format a SQL query

  1. 1

    Paste the SQL

    One query or a whole script.

  2. 2

    Pick the dialect

    Match the database you use.

  3. 3

    Choose keyword case and indent

    UPPERCASE keywords are the most common style.

  4. 4

    Copy the result

    Or download a .sql file.

Key features

  • 10 SQL dialects

    From MySQL and Postgres to BigQuery and Snowflake.

  • Keyword casing

    Upper, lower or preserve.

  • Handles complex queries

    CTEs, window functions, CASE and nested subqueries.

  • Stays private

    Queries never leave your browser.

Common uses

  • Debugging ORM output: Make generated SQL readable to spot slow joins.
  • Code reviews: Consistent formatting makes query changes obvious.
  • Documentation: Paste clean queries into wikis and tickets.

Tips and good to know

  • Formatting doesn't change what a query does, so it's safe to run the formatted version.
  • Formatting JSON returned by a query? Use the JSON Formatter.

Frequently asked questions

Which databases are supported?

Standard SQL plus MySQL, MariaDB, PostgreSQL, SQLite, SQL Server, Oracle PL/SQL, BigQuery, Snowflake and Amazon Redshift.

Does it check my SQL for errors?

It formats based on the SQL grammar and reports text it can't parse, but it doesn't connect to a database, so it can't check that tables or columns exist.

Are my queries stored?

No. Formatting happens locally and nothing is sent to a server.