ToolsForWeb

Saved

Tap ☆ on any tool to keep it here.

toolsforweb

SQL Formatter

Pretty-print SQL with dialect-aware keywords, indent and case options.

Runs in your browser — nothing is uploaded

Loading tool…

Results are provided as is, for general information. Check anything important before relying on it. See the Terms of Use.

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

Reading a 40-line generated query before you touch it.
Reviewing SQL in a pull request where everyone's formatting differs.
Normalizing a team's query style with one shared setting set.
Debugging a query by restructuring it clause by clause.

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.

Related tools