SQL Formatter
Automatically format SQL queries.
Input
Output
What is SQL Formatter?
SQL Formatter rewrites compact or inconsistently spaced SQL with predictable indentation and line breaks. It makes queries easier to review in logs, tickets, migrations, and debugging sessions while leaving the developer responsible for checking the statement's meaning and database-specific syntax.
How to use SQL Formatter
Paste the SQL query, run the formatter, and copy the structured result with clearer spacing and line breaks.
When is SQL Formatter useful?
SQL Formatter is useful when reading compact SQL, reviewing queries in pull requests, or cleaning generated statements before debugging.
Example
A practical example is formatting a long SELECT statement with joins and filters so each logical section is easier to inspect.
Practical notes
Formatting does not validate table names, permissions, parameters, or query safety. Compare the result before execution, use parameterized queries for user input, and test write operations inside a transaction or non-production database whenever possible.