← All tools
Free tool

SQL Formatter

Paste messy SQL and get clean, consistently formatted PostgreSQL in seconds. Keyword casing, smart indenting, copy or download. Free, no signup, private.

Keywords:
Indent:
PostgreSQL
input.sql · 1 line
formatted.sql · 1 → 15 lines
SELECT
  u.email,
  count(p.id) AS post_count
FROM
  users u
  LEFT JOIN posts p ON p.user_id = u.id
WHERE
  u.created_at > now() - interval '30 days'
  AND p.published = TRUE
GROUP BY
  u.email
ORDER BY
  post_count DESC
LIMIT
  20;

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

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 →