ZapKit

SQL Formatter & Beautifier

Turn a one-line or messy SQL query into neatly indented, readable SQL for your database, or collapse it to a single line.

What is a SQL formatter?

A SQL formatter rewrites a database query with consistent line breaks, indentation and keyword capitalisation so its structure is easy to read. Queries copied out of application logs, ORMs and BI tools usually arrive as one enormous line, which makes joins and conditions hard to follow and bugs easy to miss.

Formatted SQL is easier to review in pull requests, explain to colleagues and paste into documentation. This formatter supports the major dialects, lets you choose uppercase or lowercase keywords and two spaces, four spaces or tabs, and can minify a query back to one line. Your SQL is processed in the browser, never sent anywhere.

How to use the SQL Formatter

  1. 1.Paste the SQL

    One query or several separated by semicolons.

  2. 2.Pick the dialect and style

    Choose your database, keyword case and indent size.

  3. 3.Copy or download

    Save it as a .sql file or copy it back into your editor.

Example: a one-line report query

A query joining orders, customers and items with a WHERE, GROUP BY, HAVING, ORDER BY and LIMIT, formatted as Standard SQL:

Lines
1 → 20
Keywords
select, from, join → SELECT, FROM, JOIN
Conditions
each AND on its own indented line
Strings
'2026-01-01' and ('IN', 'US') unchanged

Each clause starts a new line, making the two joins and the HAVING condition easy to check.

Dialect-aware formatting

Databases differ: MySQL quotes names with backticks, SQL Server uses brackets, PostgreSQL has :: casts and dollar-quoted strings. Choosing the right dialect lets the formatter recognise these instead of breaking them. Main clauses like SELECT, FROM, WHERE and GROUP BY start new lines, and columns and conditions are indented beneath them.

Minify keeps string literals and quoted identifiers exactly as written, removes -- and /* */ comments and collapses whitespace, which is handy for logging a query or pasting it into code. Formatting never changes what the query does.

Frequently asked questions

Does formatting change my query's results?

No. Only whitespace and, if you choose, keyword capitals change. Strings and names are untouched.

Does it check that my SQL is valid?

Not fully. It formats what it can parse; a typo such as SELEC may be formatted without a warning.

Are comments kept?

Formatting keeps them. Minifying removes them, so nothing after a -- comment can swallow the rest of the line.

Which databases are supported?

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

More Developer tools