Unformat.online

Format PostgreSQL Online

Beautify PostgreSQL queries with proper indentation and keyword formatting. Paste your Postgres SQL and get clean, readable output instantly — 100% client-side.

Rules:Smart QuotesConverts curly quotes (“” ‘’) to straight quotes. Always active.Non-Breaking SpacesReplaces non-breaking spaces (U+00A0) with regular spaces. Always active.Line EndingsNormalizes CRLF → LF and trims trailing whitespace per line. Always active.Removes invisible zero-width characters (U+200B, U+200C, U+200D) that silently break string comparisons.Strips the Byte Order Mark (U+FEFF) that causes “invalid character” errors in parsers and editors.Removes soft hyphens (U+00AD) from PDFs that show as garbled characters in code editors.Converts mixed tabs/spaces to a consistent indent width. Click to pick a size.Collapses all line breaks into one continuous paragraph. Great for reflowing PDF or email text.Control blank line density. Click to pick Keep 1 or Remove all.Text never leaves your browser
0 characters

PostgreSQL SQL formatting

PostgreSQL has an expressive SQL dialect with features not found in the SQL standard: window functions, RETURNING clauses, WITH (CTE) support, JSONB operators, and double-quoted identifiers. Using the PostgreSQL dialect ensures these constructs are formatted correctly.

This formatter handles PostgreSQL-specific syntax including ILIKE, SIMILAR TO, :: cast syntax, LATERAL joins, and array expressions. Standard SQL formatters may produce incorrect results for these constructs.

How to format PostgreSQL queries

  1. Paste your PostgreSQL query into the text area above.
  2. The formatter is pre-set to PostgreSQL dialect. Toggle keyword casing as needed.
  3. Copy the formatted output with the Copy button or Ctrl+K.