ToolSink

SQL Formatter

Format SQL queries into clean, readable multi-line syntax. Supports MySQL, Postgres, T-SQL, BigQuery and more.

What is the SQL Formatter?

The SQL Formatter reformats a jumbled one-line query into readable, indented, multi-line SQL with consistent keyword casing. It supports MySQL, PostgreSQL, SQL Server, SQLite, BigQuery, Oracle and MariaDB.

Formatting only rearranges whitespace and casing — the query executes identically. Everything runs in your browser.

How to use the SQL Formatter

  1. 1Paste your SQL query into the input area.
  2. 2Pick the database dialect.
  3. 3Choose indentation width and keyword casing.
  4. 4Click "Format" and copy the tidied query back to your editor.

Key features

  • Dialect-aware formatting for all major databases
  • Configurable indentation and keyword casing
  • Aligns SELECT columns, JOIN conditions and WHERE clauses
  • Handles subqueries and CTEs, preserves comments
  • Minify option to collapse whitespace

Frequently asked questions

Does the formatter change my results?

No — only whitespace and casing change. The query still executes identically.

Can it format stored procedures?

Yes — DECLARE, IF/ELSE and LOOP constructs are handled for popular dialects.

Tap any tool to jump straight in — no signup, works on mobile.

View all →