Formatter · PostgreSQL
Format PostgreSQL SQL online
Reformat PostgreSQL queries against PostgreSQL's own grammar: consistent indentation, aligned clauses and uppercase keywords. Paste one-line or ORM-generated SQL and get structured, reviewable output.
1Paste your PostgreSQL query into the editor.
2Press Format — or ⌘↵.
3Copy clean, highlighted SQL.
Why format PostgreSQL?
PostgreSQL adds syntax no generic beautifier handles cleanly: the JSONB accessors -> and ->>, :: casts, ILIKE, RETURNING clauses and array literals. The formatter parses against Postgres grammar so these stay intact instead of being mangled into keywords.
It also keeps dollar-quoted strings ($$ … $$) and CTEs structurally correct — the exact constructs that make hand-formatting Postgres tedious.