SQL Formatter
Format messy SQL into clean, indented queries. Supports PostgreSQL, MySQL, SQL Server, Oracle, SQLite, BigQuery and more, with keyword casing options.
Runs in your browser. Nothing is uploaded.
About SQL Formatter
SQL Formatter takes a one-line or badly indented query and lays it out with each clause (SELECT, FROM, JOIN, WHERE, GROUP BY) on its own line and sub-queries indented. Long queries copied from logs, ORMs or query plans become readable in one step.
Pick your dialect so vendor-specific syntax such as PostgreSQL casts, T-SQL brackets or BigQuery backticks is understood, and choose whether keywords are upper or lower case. Formatting uses the open source sql-formatter library and runs in your browser.
How to use SQL Formatter
- Type or paste your text into the input box. Press Sample to see an example.
- Adjust the options. The result updates as you type.
- Copy the result, or press Use as input to chain another transformation.
Frequently asked questions
Does formatting change what the query does?
No. Only whitespace, line breaks and, if you choose, keyword case change. Identifiers, literals and the order of clauses stay the same.
Why do I get a parse error?
The formatter has to understand the syntax. Pick the dialect that matches your database, and check for unbalanced quotes or brackets.
Is SQL Formatter free and private?
Yes. SQL Formatter is completely free with no sign-up. Everything runs in your browser, so whatever you type or paste never leaves your device.