SQL Formatter
Format SQL queries with consistent indentation and keyword case for PostgreSQL, MySQL, SQL Server, Oracle, SQLite, BigQuery and standard SQL.
What is the SQL Formatter?
Formatted SQL is easier to read, review and debug, especially for long joins and nested queries.
How does it work?
The query is tokenised with a dialect-aware parser and re-printed with line breaks before clauses and indentation for nested expressions.
Example
A one-line SELECT with JOIN, WHERE and GROUP BY becomes a clearly structured multi-line query.
Frequently asked questions
Is my data sent to a server?
No. This tool runs entirely in your browser; nothing you paste is uploaded or stored.
Does it change what my query does?
No. Only whitespace and keyword case change.
Related tools
Enable JavaScript to use this calculator.