SQL Formatter

Format SQL for MySQL, PostgreSQL, SQLite and more with consistent indentation and keyword case.

Paste SQL and press Format, or use Ctrl/⌘ + Enter.

What this tool does

Paste a long or minified query and get readable SQL back: one clause per line, nested subqueries indented, columns in SELECT lists and JOIN conditions each on their own line, and keywords in the case you prefer. Pick the dialect that matches your database so dialect-specific syntax such as backticks in MySQL, square brackets in SQL Server, double-colon casts in PostgreSQL or Oracle's PL/SQL blocks is understood correctly. Several statements separated by semicolons are formatted together, with a configurable number of blank lines between them. The output keeps your table and column names exactly as written; only whitespace and keyword case change.

Tips and common questions

Privacy

Your SQL stays in the browser. Queries containing real table names, customer data or credentials are never transmitted.