SQL Formatter
Paste a query and get it cleanly formatted: keywords uppercased (or lowered, or preserved), your choice of 8 dialects including MySQL, PostgreSQL, T-SQL, SQLite, BigQuery and DuckDB, configurable indent and blank lines between queries. Parse errors report the line and column the parser stumbled on. Runs entirely in your browser.
About this tool
Turns a dense SQL query into readable, consistently indented form: keywords on their own lines, clauses aligned, your choice of keyword case (uppercase, lowercase or preserved), 2/4-space or tab indent, and one or two blank lines between statements. Eight dialects are supported — standard SQL, MySQL, PostgreSQL, T-SQL, SQLite, MariaDB, BigQuery and DuckDB — because dialects genuinely differ (T-SQL keeps TOP inline where others put LIMIT on its own line; MySQL accepts backtick identifiers). When the input does not parse, the error names the line and column and shows the offending text.
When to use it
Questions
Does it run or change my SQL?
No. Formatting is purely textual — the tool never executes anything, never connects to a database, and the query never leaves your browser. Whitespace and keyword casing change; identifiers, strings and logic do not.
Which dialect should I pick?
Standard SQL is a safe default. Pick your actual engine when syntax differs: T-SQL for SQL Server (TOP instead of LIMIT), MySQL or MariaDB for backtick identifiers, BigQuery for its dotted table paths. The formatter uses the dialect to decide keyword placement and accepted syntax.
Can it minify SQL instead?
Not currently. Compacting SQL is riskier than expanding it — string literals and comments make naive collapsing wrong — so the tool only formats for readability. Paste the pretty output into a minifier if you truly need one line.