OpenReplay Logo
12k
12k

SQL formatter

Format and beautify SQL for any major dialect. Processed locally in your browser, so your queries never leave your machine.

SQL

Paste SQL, drop a file, or

Format Processed locally Local

About this tool

A SQL formatter normalizes the whitespace, indentation, and keyword casing of a query without changing what it does. It parses your SQL into tokens and re-emits them with consistent line breaks and two-space indentation, so clauses like SELECT, JOIN, WHERE, and GROUP BY line up predictably. This tool supports Standard SQL plus dialect-specific rules for PostgreSQL, MySQL, SQLite, BigQuery, Snowflake, and SQL Server, and normalizes keywords to uppercase for consistent, readable queries.

Use it to clean up a one-line query copied from an ORM log, make a dense generated statement reviewable in a pull request, or standardize casing across a team's SQL files.

Formatting only rearranges whitespace and casing — it never validates that your query is correct against a real schema.

Frequently asked questions

Which SQL dialects does this formatter support?

It supports Standard SQL, PostgreSQL, MySQL, SQLite, BigQuery, Snowflake, and SQL Server (Transact-SQL). Each dialect applies its own keyword and syntax rules so the output matches that engine's conventions.

Does formatting change what my SQL query does?

No. Formatting only adjusts whitespace, indentation, and keyword casing — the tokens and logic of the query are unchanged, so a formatted query runs identically to the original.