SQL Formatter
Paste messy SQL and get clean, consistently formatted PostgreSQL in seconds. Keyword casing, smart indenting, copy or download. Free, no signup, private.
Formatted SQL appears here…
Why format your SQL
- Readable diffs — formatted migrations produce clean pull-request diffs instead of single-line noise
- Faster debugging — a misplaced JOIN or WHERE is obvious when every clause starts on its own line
- Team consistency — one style for every query, enforced in seconds rather than by convention docs nobody reads
- Log triage — paste a 400-character query from your app logs and actually read it
Frequently asked questions
What does the SQL formatter do?
It takes messy SQL — single-line queries from logs, ORM output, or hand-written DDL — and re-indents it with consistent keyword casing and line breaks. The meaning of your query never changes, only the layout.
Is my SQL private?
Yes. Formatting runs entirely in your browser with no server round-trip. Your SQL is never uploaded, stored, or logged.
Which SQL dialect is supported?
PostgreSQL. The formatter understands Postgres-specific syntax including dollar-quoted strings, casts, and procedural blocks.
Can it format SELECT queries or only CREATE TABLE?
Both. SELECTs, JOINs, CTEs, DDL, migrations — anything valid PostgreSQL formats correctly.
Should keywords be uppercase or lowercase?
There is no technical difference — Postgres is case-insensitive for keywords. UPPERCASE is the traditional DBA style; lowercase matches modern dbt-style analytics codebases. Pick one and enforce it. The formatter supports both plus preserve.
I formatted my schema SQL — what next?
Visualize it as an interactive ER diagram, or run it through the schema health analyzer to catch missing keys and slow joins before you ship.
Related tools
Formatted your schema? See it as a diagram
Paste your PostgreSQL connection string and get an interactive ER diagram in under 10 seconds. No signup required.
Try it free →