SQL Formatter
Beautify messy SQL queries into readable statements.
Long SQL statements written on a single line — or generated by an ORM — are painful to review.
About SQL Formatter
Turn dense, single-line SQL into cleanly indented, readable statements with proper keyword casing and line breaks. This free SQL formatter and beautifier supports common dialects and is handy for reviewing query logs, cleaning up ORM-generated SQL, or preparing queries to share in a pull request or documentation.
Long SQL statements written on a single line — or generated by an ORM — are painful to review. This SQL formatter breaks a query into logical clauses, indents subqueries and joins, and normalises keyword casing so SELECT, FROM, WHERE and GROUP BY line up and the query's structure becomes obvious. It supports standard SQL along with popular dialects, and everything runs locally in your browser.
How to use SQL Formatter
- Paste the SQL query or script you want to tidy.
- Pick a SQL dialect and indentation style if the defaults don't suit you.
- Review the formatted statement in the output panel.
- Copy the result into your editor, pull request or documentation.
Key features
- Consistent keyword casing and clause-per-line layout.
- Readable indentation for nested subqueries, CASE expressions and joins.
- Works with multiple statements in one paste.
- No account, no upload, no query logging.
Common use cases
- Making an ORM-generated query legible while investigating slow-query logs.
- Standardising SQL in code reviews so diffs show real changes, not whitespace.
- Preparing well-formatted queries for tutorials, tickets and documentation.

