About this tool
SQL generated by an ORM, copied from a slow query log, or written in a hurry often comes out as one dense, hard-to-read line. This tool reformats SQL queries with consistent keyword casing, proper indentation for clauses like SELECT, FROM, JOIN, WHERE, and GROUP BY, and line breaks in the places a human would naturally read the query — turning a wall of text into something you can actually scan and debug. It handles nested subqueries and multi-table joins without losing the underlying logic. This is particularly useful when reviewing a colleague's pull request, debugging a slow query pulled from a database log, or documenting a query for a report. Formatting runs entirely in your browser.
Frequently asked questions
Does formatting change what the query actually does?
No — formatting only affects whitespace, line breaks, and keyword casing; the query logic and results are completely unchanged.
Does it support nested subqueries?
Yes, nested subqueries are indented to reflect their nesting level so the overall query structure stays readable.
Can I control keyword casing (uppercase vs. lowercase)?
Yes, you can choose whether SQL keywords like SELECT and WHERE are formatted in uppercase or lowercase.
Which SQL dialects does it support?
It handles standard ANSI SQL syntax used across MySQL, PostgreSQL, SQL Server, and SQLite; highly dialect-specific syntax may format less predictably.
Will it validate my SQL for errors?
The formatter focuses on readability rather than full syntax validation — severely malformed SQL may format oddly rather than being flagged as invalid.