SQL Formatter
Paste a messy, nested, or single-line SQL query and get clean, indented, readable SQL. Supports multiple dialects and configurable keyword casing so your queries are easy to review and debug.
About the SQL Formatter
SQL queries grow quickly — multiple joins, nested subqueries, long WHERE clauses — and when they arrive as one unbroken line they are nearly impossible to review. A formatter applies consistent indentation, line breaks, and capitalization so the structure of the query becomes visible.
Readable SQL is easier to debug, easier to review in a pull request, and less likely to hide a logic error in a misplaced clause. Because different engines have slightly different syntax, choosing the right dialect ensures keywords and operators are formatted correctly.
How to use it
- 1Paste your SQL query into the input panel.
- 2Pick your database dialect and preferred keyword case.
- 3Copy the cleanly formatted result for your editor or pull request.
Features
- Formats SQL across MySQL, PostgreSQL, T-SQL, SQLite, BigQuery and more
- Configurable keyword case (UPPER / lower) and indentation
- Handles deeply nested subqueries and long JOINs
- One-click copy of the formatted query
Frequently asked questions
Which SQL dialects are supported?
Standard SQL plus MySQL, PostgreSQL, T-SQL (SQL Server), SQLite, BigQuery, MariaDB and others. Pick the one that matches your database for the best results.
Does it change my query logic?
No. Formatting only changes whitespace and keyword casing for readability — the query itself is unchanged.
Can it format an invalid query?
It formats based on SQL tokens, so it can usually tidy partial or slightly invalid SQL, though severely malformed input may not format cleanly.
Is my SQL sent anywhere?
No. Formatting runs entirely in your browser, so queries containing real table or column names stay private.