SQL Formatter

Format SQL for any major dialect with proper indentation.

100% Private Instant Free Forever
SQL input
Formatted SQL

What is a SQL Formatter?

A SQL formatter rewrites a raw SQL query into a consistent, readable shape — capitalising keywords, aligning SELECT columns, and breaking JOIN clauses onto fresh lines. Well-formatted SQL is dramatically easier to review in pull requests, debug under pressure, and copy out of log files.

What this tool does

  • 12 dialects — PostgreSQL, MySQL, MariaDB, SQLite, BigQuery, Redshift, Spark, DB2, PL/SQL, T-SQL, N1QL, plus a generic Standard SQL mode.
  • Tab width — 2 or 4 spaces.
  • Keyword case — upper, lower, or preserve as-typed.
  • Comment preservation — single-line and block comments are kept.

Tips

  • Stick to one dialect across your codebase so the formatter is deterministic across teammates.
  • If a query won't format, paste a smaller chunk — most issues come from truncated statements.
  • The formatter does not execute SQL — it's purely syntactic, so it is safe to paste production queries.

Formatting happens entirely in your browser; your queries never reach a server.