When to use this
Beautify a query copied from pgAdmin, a slow-query log or an EXPLAIN plan before you paste it into a review or a ticket.
This page is a focused view of theSQL Formatter & Beautifier, which has the full set of options.
Paste a PostgreSQL query to pretty-print it with 2 spaces, 4 spaces or tabs, or minify it. The dialect is already set to PostgreSQL, so dollar-quotes, RETURNING and DISTINCT ON stay intact. Keyword case can be upper, lower or preserve. Schema names and literals never leave this tab.
Runs in this tab · nothing is uploaded · Verify in 10 seconds →
This page is the SQL Formatter locked to the PostgreSQL dialect, so dollar-quotes, RETURNING, DISTINCT ON and interval literals are recognised as keywords and not broken across lines. Pick keyword case and indent, then press Format. Queries stay in this tab.
PostgreSQL is the dialect most production logs use for JSON, arrays and CTEs. Formatting does not change identifiers or string literals, including spaces inside 'Ada Lovelace' and bodies inside $$ … $$. Only whitespace and, if you ask, keyword case change.
A friendly parse error means the dialect could not read the statement: usually an unclosed quote, an unclosed /* comment or a dollar-quote tag that never closes. The first line of the error is shown; fix that and format again.
Beautify a query copied from pgAdmin, a slow-query log or an EXPLAIN plan before you paste it into a review or a ticket.
This page is a focused view of theSQL Formatter & Beautifier, which has the full set of options.
No. Formatting loads the formatter library in this tab. Schema names and customer literals never leave the device.
The PostgreSQL dialect recognises Postgres-only syntax such as dollar-quoting, RETURNING and DISTINCT ON so those tokens are not split or lowercased incorrectly.
Yes. The dialect picker is still on the toolbar, or open the full SQL Formatter for every dialect.
No. String literals, comments and dollar-quoted bodies stay as written.
It collapses insignificant whitespace while leaving strings and comments byte-for-byte, useful for a single log line.
Upper is the common house style for SQL keywords. Preserve keeps whatever you pasted. Lower is used by some codebases.