SQL Formatter: Beautify & Standardize SQL Online

Paste unformatted SQL and get it reformatted with consistent indentation, keyword casing, and line breaks — pick a dialect (Snowflake, PostgreSQL, MySQL, BigQuery, Redshift, SQL Server, SQLite, Spark, or generic SQL) so keywords specific to that engine are recognized correctly. Optionally case identifiers/functions/data types the same way as keywords, and keep or strip comments.

Switch to Customized style for a stricter, opinionated layout: leading or trailing commas, forced double-quoted UPPERCASE identifiers, tables self-aliased to their own name, and column-aligned AS clauses and WHERE/ON conditions — each independently toggleable. It's scoped to single SELECT statements (CTEs supported).

This is a formatter, not a validator: it reflows whitespace and casing, it doesn't check whether the query is logically correct, and it runs entirely in your browser — nothing you paste in is sent anywhere.

There's also an optional AI-assisted "Get AI Suggestions" pass: readability notes, and — only where genuinely worth it — a CTE-based rewrite of a complex subquery for you to review. This is a suggestion to apply yourself, never an automatic change, and it's scoped to readability, not true query-plan optimization, which would need real database access (schema, statistics, an execution plan) this tool doesn't have.