Developer tools

SQL formatter and beautifier.

Paste SQL, pick your dialect, and get clean, consistent formatting instantly.

Input

SQL query

§

What is an SQL formatter?

An SQL formatter, or SQL beautifier, turns hard-to-read queries into consistently indented, clause-aligned code. Instead of scanning a single-line query for the JOIN conditions, you can read the statement top-to-bottom the same way you read a well-formatted program.

Before

SELECT u.id,u.name,COUNT(o.id) AS cnt FROM users u LEFT JOIN orders o ON o.user_id=u.id WHERE u.active=1 GROUP BY u.id,u.name HAVING COUNT(o.id)>0 ORDER BY cnt DESC;

After

SELECT
  u.id,
  u.name,
  COUNT(o.id) AS cnt
FROM users u
LEFT JOIN orders o ON o.user_id = u.id
WHERE u.active = 1
GROUP BY u.id, u.name
HAVING COUNT(o.id) > 0
ORDER BY cnt DESC;

Why dialect matters

Identifiers are quoted differently per database: [orders] for SQL Server, `orders` for MySQL and BigQuery, "orders" for PostgreSQL. The dialect setting keeps those conventions intact while normalizing everything else.

FAQ

What does an SQL formatter do?+

An SQL formatter (also called an SQL beautifier) rewrites the whitespace of a query — line breaks and indentation — so that SELECT, FROM, WHERE, JOIN, and GROUP BY clauses align in a readable way. It never changes the meaning of the query.

Why does the formatter ask for a SQL dialect?+

SQL dialects differ in syntax — for example BigQuery uses backticks for identifiers, SQL Server uses square brackets, and Oracle uses its own PL/SQL blocks. Choosing the right dialect lets the formatter keep your syntax intact and format it correctly.

Will formatting break my query?+

No. Formatting only changes whitespace and optional keyword casing. String literals, comments, and the order of your statements are preserved exactly.

Can it format multiple statements at once?+

Yes. Paste multiple statements (for example a CREATE TABLE followed by an INSERT) and the formatter keeps each statement separated and readable.

About SQL Formatter

Paste or type SQL into the editor, choose your database dialect, and format it instantly. Formatting is deterministic and stateless — nothing is stored on the server.

  • Dialect-aware formatting for 12 major databases.
  • Optional uppercase, lowercase, or preserved keyword casing.
  • Configurable 2 or 4 space indentation.
  • Copy, download, and file load support.

More tools