Formats and beautifies SQL queries so they're easier to read.
Input
select id, name from users where active = 1
Output
SELECT id, name FROM users WHERE active = 1
SQL queries written quickly or generated by an ORM often arrive as one dense line with no consistent capitalization. That's workable for a database engine since whitespace barely matters to a query planner. It's considerably harder on a person trying to spot which table a join actually targets or where one clause ends and the next begins at a glance.
This formatter uppercases recognized keywords like SELECT FROM WHERE JOIN GROUP BY and ORDER BY then places each major clause on its own line. A SELECT list with more than a handful of columns gets split too with one column per indented line which makes long column lists far easier to scan than a single run-on row of names separated by commas. Shorter column lists stay compact on one line since breaking a two or three column SELECT apart would add lines without adding clarity.
Comma splitting respects parentheses, so a column expression like a function call with its own argument list isn't split in the wrong place. That's a common failure mode for naive SQL formatters, and it was worth getting right even in a tool this lightweight.
This is a best-effort formatter working from string and regex matching, not a real SQL parser with full grammar awareness for every database dialect. It handles the common clauses and join variants you'd see in everyday SELECT INSERT UPDATE and DELETE statements fairly well. Exotic dialect-specific syntax, deeply nested subqueries, or vendor extensions might not come out looking quite as clean, though the keyword uppercasing will still generally apply correctly.
Nothing you paste in gets sent anywhere, the formatting runs entirely in your browser using plain JavaScript string processing. That makes it fine to use on queries that touch real table and column names you'd rather not share with an external service.
More Developer Tools