Make messy SQL readable
You copy a query out of a log and it's one long line. Or an ORM spits out something nobody can follow. Formatting fixes that. Keywords line up, clauses break onto their own lines and nested parts are indented.
Paste your SQL, choose a dialect and get a clean version back. You can set indent size and decide whether keywords should be upper or lower case.
Dialects matter
SQL isn't one language. MySQL, PostgreSQL, BigQuery and T-SQL each have their own quoting, functions and quirks. MySQL uses backticks. T-SQL uses square brackets. BigQuery has its own table path style.
Picking the right dialect lets the formatter treat those parts correctly instead of splitting them in odd places.
What it formats
SELECT queries, of course, along with CTEs written with WITH. CREATE TABLE and ALTER TABLE statements format fine as well, since they follow standard patterns.
Procedural blocks like stored procedures and PL/pgSQL code are trickier. Formatting depends on the exact syntax, so look at the result before you rely on it. Procedural code is where a formatter is most likely to make odd line breaks.
It doesn't validate
A formatter changes layout, not meaning. It won't tell you that a column doesn't exist or a join is wrong. A query that formats nicely can still fail when you run it. Treat the tool as a reading aid, and test the query against the database as usual.
Why formatting pays off
Readable SQL gets reviewed properly. A reviewer can spot a missing join condition when it's on its own line. Version control diffs stay small when everyone formats the same way, so a change to one filter doesn't rewrite the whole query.
- One clause per line makes reviews quicker
- Consistent keyword case avoids pointless diffs
- Indented subqueries show structure at a glance
Privacy
Formatting happens in your browser. The query isn't sent to a server, which matters when table names or filter values hint at how your business works.