SQL Formatter & Beautifier

Format and beautify SQL for 10 dialects including PostgreSQL, MySQL, SQLite, BigQuery, Snowflake, and T-SQL. Uppercase keywords, custom indent.

Runs 100% in your browser — nothing is uploaded.
Formatted

How to use

  1. 1
    Paste your SQL

    Any query — SELECT, DDL, procedures. Even one-liners get broken across lines.

  2. 2
    Pick your dialect

    PostgreSQL, MySQL, SQLite, BigQuery, Snowflake, T-SQL, and more. Affects keyword recognition and quirks.

  3. 3
    Tune indent + case

    2 or 4 spaces, uppercase or lowercase keywords — match your team's style guide.

  4. 4
    Copy the formatted query

    Drop it into a pull request, a runbook, or a code review comment.

Examples

One-liner → readable
Input
select u.name,count(*) as n from users u join orders o on o.uid=u.id where o.total>100 group by u.name order by n desc limit 10
Output
SELECT
  u.name,
  count(*) AS n
FROM
  users u
  JOIN orders o ON o.uid = u.id
WHERE
  o.total > 100
GROUP BY
  u.name
ORDER BY
  n DESC
LIMIT
  10
Uppercase keywords, 2-space indent, joins pulled onto their own indented line.
BigQuery UNNEST
Input
select user_id, tag from users, unnest(tags) as tag where created_at > "2026-01-01"
Output
SELECT
  user_id,
  tag
FROM
  users,
  unnest(tags) AS tag
WHERE
  created_at > "2026-01-01"
Dialect-aware — BigQuery keeps unnest() as-is instead of choking on it.

Frequently asked

Which dialects are supported?

Standard SQL, PostgreSQL, MySQL, MariaDB, SQLite, BigQuery, Redshift, Snowflake, T-SQL (SQL Server), and DB2. Pick the right one — it affects keyword recognition and specific syntax.

Does it validate my SQL?

Only lightly — enough to format. For proper validation, run the query against your database or use its EXPLAIN command.

Is my query uploaded?

No. Formatting runs in your browser via the sql-formatter library. Nothing leaves your device.

Related tools