SQL Formatter
Paste a messy or minified SQL query to get it reformatted with consistent indentation, line breaks around clauses, and keyword casing — supports Standard SQL, MySQL, PostgreSQL, SQLite, SQL Server, Oracle PL/SQL, and BigQuery dialects.
How to use
- Paste a SQL query and pick the matching dialect.
- Choose keyword casing (UPPERCASE, lowercase, or preserve as-typed) and indent width.
- Copy the formatted result.
FAQ
Why does dialect matter for formatting?
Each database has its own quoting rules, keywords, and syntax extensions (e.g. PostgreSQL's `::type` casts, BigQuery's backtick-quoted table paths) — picking the right dialect avoids the formatter misparsing dialect-specific syntax.
Does this validate the query or just format it?
It's a formatter, not a full SQL validator — it can reformat syntactically odd but parseable queries without catching every semantic issue, e.g. referencing a column that doesn't exist in the table.