SQL Formatter

Format and beautify SQL queries online. Supports MySQL, PostgreSQL, SQLite, and more. Customizable indentation and keyword casing.

All processing happens in your browser

About SQL Formatting

SQL formatting transforms messy or minified SQL queries into a well-structured, readable layout with consistent indentation and keyword casing. Readable SQL is easier to debug, review, and maintain, especially in complex queries with multiple joins, subqueries, and conditional logic.

Paste your SQL query, select your database dialect, and the formatter instantly produces clean, indented output. Toggle uppercase keywords for the common convention of writing SQL keywords in capitals (SELECT, FROM, WHERE) while keeping identifiers in their original case.

SQL formatting is essential for code reviews and pull requests, debugging complex queries with joins and subqueries, documenting database schemas and migration scripts, onboarding new team members to existing queries, and maintaining consistent coding standards across a team.

The formatter supports Standard SQL, MySQL, PostgreSQL, SQLite, MariaDB, BigQuery, and T-SQL dialects. Each dialect has specific syntax variations — for example, MySQL uses backticks for identifiers while PostgreSQL uses double quotes. Selecting the correct dialect ensures the formatter handles dialect-specific syntax correctly.

FAQ

Related Tools