About SQL Formatter
Format or compact SQL with dialect-aware tokenization. The formatter library loads only when requested.
SQL Formatter applies dialect-aware formatting for PostgreSQL, SQL Server, MySQL, and SQLite, with indentation and keyword-case controls. Compact mode removes unnecessary whitespace without executing the statement.
How to use it
- Enter or select your source data.
- Adjust the available options and run the tool.
- Review, copy, or download the result.
Common use cases
- Make a long generated query readable during debugging.
- Standardize SQL examples in documentation or reviews.
- Compact a statement before placing it in a constrained fixture.
Worked example
Reformat a PostgreSQL SELECT with two-space indentation and uppercase keywords.
Limitations and responsible use
- Formatting does not parse against a live database or guarantee that a query is valid.
- Vendor extensions outside the selected dialect may be formatted imperfectly.
- Minification is whitespace-focused and should be reviewed around unusual quoting or procedural SQL.
Frequently asked questions
Will the query be executed?
No. There is no database connection; the input is transformed as text in the browser.
Can formatting optimize query performance?
No. Use an execution plan and database-specific analysis for performance work.