SQL Formatter

Uppercase keywords, clean clause layout โ€” strings never touched.

About this formatter

Paste a query; get it back with keywords uppercased, each major clause on its own line, AND/OR conditions indented and select-lists split at commas โ€” while string literals, quoted identifiers and comments pass through byte-for-byte, guaranteed by stashing them before any transformation touches the text.

Formatting as code review

SQL laid out one clause per line isn't aesthetics โ€” it's how bugs surface. The classic killers hide in one-line queries: an OR without parentheses quietly changing what AND binds to, a missing JOIN condition turning into a row-multiplying cross join, a WHERE that filtered nothing because it sat in the wrong subquery. Vertical layout gives each clause a line for your eye to interrogate. Honest scope: this is a tidier, not a parser โ€” deeply nested subqueries come out readable rather than perfectly indented, and dialect quirks (backticks, brackets) are preserved not validated. Formatted locally, so production queries with real table names are safe to paste. Regex, JSON and XML keep the same promises next door.

Frequently asked questions

Does formatting change what the query does?

No โ€” only whitespace and keyword casing change. Strings, quoted identifiers and comments are extracted before formatting and restored byte-for-byte after.

Why uppercase SQL keywords?

Pure legibility convention: SELECT and FROM in caps make structure jump out of lowercase table and column names. SQL itself is case-insensitive for keywords โ€” this is for humans.

Is it safe to paste production queries?

Yes โ€” formatting happens in your browser and nothing is transmitted or stored. Close the tab and the query is gone.

Will it validate my SQL?

No โ€” it tidies without parsing, so syntax errors survive formatting. It will, however, make many of them visible for the first time.