SQL Formatter & Beautifier

Paste SQL to pretty-print it with 2 spaces, 4 spaces or tabs, or minify it to one line. Pick a dialect (Standard SQL, PostgreSQL, MySQL, SQL Server, SQLite or BigQuery) and keyword case (upper, lower or preserve). Queries stay in this tab, so schema names and customer literals from logs are never uploaded.

Input
Output
Waiting for Format or Minify

Runs in this tab · nothing is uploaded · Verify in 10 seconds →

What the SQL Formatter & Beautifier does

A SQL formatter pretty-prints a compact query so joins, filters and aliases are readable, or minifies it back to one line for logs and tickets. Format SQL, SQL beautifier and SQL pretty print are the same job: re-indent the statement without changing identifiers or literals. Use it on queries copied from Postgres, MySQL, SQL Server, SQLite or BigQuery logs.

How the SQL Formatter & Beautifier works

Paste SQL, drop a .sql file, or load the sample. Pick a dialect (Standard SQL, PostgreSQL, MySQL, SQL Server, SQLite or BigQuery), a keyword case (upper, lower or preserve) and an indent (2 spaces, 4 spaces or tabs), then press Format. Minify collapses insignificant whitespace while leaving strings and comments as written. Formatting loads the sql-formatter library in this tab on first use. The query never leaves the device, which matters because SQL from logs often contains table names, column names and customer literals.

Limits

A dialect that cannot parse the statement shows a friendly error. Files up to ~50 MB.

~/faq

Frequently asked questions

Does this upload my SQL?

No. Formatting runs in this tab after the page has loaded. There is no endpoint that receives the query, which you can verify in DevTools → Network.

How do I format or beautify SQL?

Paste the query, pick a dialect and indent, then press Format (Ctrl/Cmd + Enter). SQL formatter, SQL beautifier and format SQL all mean the same operation: pretty-print the statement.

Which SQL dialects are supported?

Standard SQL, PostgreSQL, MySQL, SQL Server / T-SQL, SQLite and BigQuery. The dialect changes keyword and function recognition; the data in string literals is never rewritten.

Does formatting change my query?

Only whitespace and, if you ask for it, keyword case. Identifiers, comments and string literals stay as written, including spaces inside quotes.

Why format SQL in the browser instead of a server?

Queries copied from logs often reveal schema, table names and literal customer data. A local formatter never uploads those, so a production SELECT cannot leak through this page.

What does Minify do?

It collapses spaces and line breaks that SQL does not need, while leaving -- comments, /* */ comments and quoted strings byte-for-byte. Use it to paste a query into a single log line.