Skip to content
Developer tools

SQL Formatter

Pretty-print SQL queries with newlines, indentation, and consistent keyword case.

Keywords
Indent

Built-in formatter — runs locally and handles standard SQL (SELECT, INSERT, UPDATE, DELETE, CTEs, JOINs, subqueries). For dialect-specific features (Snowflake STAGE, BigQuery UNNEST, etc.) verify output before shipping.

How it works

  1. 1Paste a SQL query.
  2. 2Pick keyword case (UPPER, lower, or preserve) and indent size.
  3. 3Copy the formatted output.

Use cases

  • Clean up SQL from copy-pasted logs.
  • Normalize team queries before code review.
  • Make a long query readable before sharing in a doc.

Frequently asked questions

Which SQL dialect?

Standard ANSI SQL. Most PostgreSQL, MySQL, SQLite, and SQL Server syntax works. Dialect-specific keywords (like UNNEST or STAGE) are passed through but may not get bespoke indentation.

Does it validate the query?

No. It is a formatter, not a parser. Invalid SQL formats best-effort without erroring.

Are strings preserved?

Yes. Anything inside single, double, or backtick quotes is kept verbatim — including the original case and whitespace.

Read the guide
How to format SQL queries that anyone can read
A formatter does not just prettify SQL — it makes structure visible. Here is how the indentation works and which style guides agree.
See all →