DevDock
All toolsDeveloper

PostgreSQL Formatter

Paste a messy Postgres query — pretty-print or minify with PostgreSQL dialect selected.

Pretty-print or minify SQL in your browser — CTEs, windows, and joins. Nothing is uploaded.

UPPER / lower rewrite keywords. Preserve keeps whatever case you typed — if the input is already lowercase, lower and Preserve look the same.

Sponsored

Ad space

How to use this tool

  1. Paste PostgreSQL from a log, console, or editor (dialect is already PostgreSQL).
  2. Choose Format or Minify, keyword case, and indent.
  3. Copy the result — or Copy as string for a JS/TS literal.

Readable Postgres from logs — no upload

CTEs and window functions turn into noise when flattened to one line. This page opens on PostgreSQL so you can expand them quickly without picking a dialect first — still fully in your browser.

Need MySQL instead? Try the MySQL Formatter. All dialects live on the SQL Formatter.

FAQ

Is this Postgres-specific formatting?

Yes. The dialect starts on PostgreSQL so CTEs, window functions, and Postgres-style quoting format the way you’d expect in psql or pgAdmin.

Does it execute my query?

No. It only reformats whitespace and keyword case (or minifies). It never connects to a database.

Is my SQL uploaded?

No. Formatting stays in your browser. Schema and table names never leave your device.

Can I switch to another dialect?

Yes. Use the dialect dropdown for MySQL, SQLite, BigQuery, T-SQL, and more — or open the general SQL Formatter hub.

What does Copy as string do?

It wraps the formatted SQL as a JavaScript/TypeScript string literal with escapes, so you can paste into app code or a query builder without hand-escaping quotes.