Why Format SQL?
SQL written by hand or generated by tools often arrives as a single unindented line, a wall of text, or with inconsistent capitalization. Formatting makes the query structure visible: which clauses are at the top level, which conditions are AND vs OR, where subqueries begin and end, and how the SELECT list is organized. This is critical for debugging slow queries, reviewing code, and onboarding new developers to a codebase.
Choosing the Right Dialect
Each SQL dialect has slightly different syntax. MySQL uses backticks for identifiers, PostgreSQL uses double quotes, SQLite is more permissive. The dialect selector tells the formatter which rules to apply. If you don't know which dialect to pick, Standard SQL is the safest default — it works for the most common queries and won't break valid SQL from any source.
Style Conventions
Most SQL style guides recommend uppercase keywords (SELECT, FROM, WHERE) for visual distinction from column and table names, 2 or 4 space indentation, and a newline before each major clause. The formatter applies these by default, with the option to switch to lowercase or preserve the original casing. Pick one and stay consistent across your project.
When to Minify SQL
Minified SQL is useful for one-liner scripts, log queries, URL parameters, embedded SQL in application code, and any context where whitespace adds bulk without value. For everything else — development, code review, debugging, version control — formatted SQL is far more useful.