SQL Formatter

Format SQL for PostgreSQL, MySQL, SQLite, and more—readable queries for docs and reviews.

When to use this tool

  • Pretty-printing a query before sharing it in a PR review.
  • Cleaning up a minified query pulled from an ORM log.
  • Teaching SQL — readable queries are easier to reason about.

How it works

  1. Paste the SQL.
  2. Pick a dialect (PostgreSQL, MySQL, SQLite, etc.) if shown.
  3. Copy the formatted output.
  4. Use the output in docs, reviews, or save it back in your codebase.

Privacy: This tool runs entirely in your browser. Your input is not sent to our servers.

Advertisement

Frequently asked questions

Is my query sent to a server?

No. Formatting runs entirely in your browser.

Does it break queries with window functions or CTEs?

Modern dialects including window functions and CTEs format correctly. Very dialect-specific syntax may need manual touch-up.

Can I re-format a formatted query differently?

Yes. Pick a different dialect or tweak indent preferences and re-format.