PostgreSQL formatter

Paste a PostgreSQL query, a migration or a view definition and make it readable: clauses on their own lines, consistent indentation and keywords in upper case, lower case or as written, with PostgreSQL's own syntax understood.

PostgreSQL syntax understood

  • :: type casts and $1, $2 parameters
  • JSON and JSONB operators such as ->, ->>, @> and ?
  • INSERT … ON CONFLICT … DO UPDATE and RETURNING
  • WITH RECURSIVE, LATERAL joins, ILIKE and = ANY (ARRAY[…])

Migrations made readable

A CREATE TABLE gets one column per line, with identity columns, jsonb defaults and constraints in place. ALTER TABLE and CREATE INDEX CONCURRENTLY … USING gin are laid out the same way, so a migration file reads from top to bottom.

From psql, logs and ORMs

Paste a query copied from psql, from pg_stat_statements or the server log, or the one-line SQL that an ORM such as Prisma, SQLAlchemy or ActiveRecord printed, and read what it really does.

Function bodies left alone

Dollar-quoted bodies ($$ … $$) of functions and DO blocks are kept exactly as written, whether they hold SQL or PL/pgSQL, so formatting never changes what a function does.

Private: nothing is uploaded

Formatting, checking and comparing all happen in your browser. Your documents are saved in the browser's own storage on this computer, not on a server, so they never leave your device.

With your permission, we count anonymous visits (which pages and tools are used), never what you type. See Privacy.

Questions

Does it check my tables and columns?

No. Nothing connects to a database: the text is laid out following PostgreSQL syntax, and whether the tables exist is for your database to say.

Does it work for Supabase, Neon or TimescaleDB?

Yes. They speak PostgreSQL, so their SQL formats the same way.

Is my data uploaded anywhere?

Your documents aren't: everything runs in your browser, and they are saved on your computer, in the browser's storage for this site. With your permission we count anonymous visits, never their content.

More tools