SQL Formatter & Minifier

Format minified SQL with syntax highlighting, or compress formatted SQL to a single line. Configurable indent, keyword case, and comma placement. 100% client-side.

🟢📖 How It Works

SQL (Structured Query Language) is the standard language for relational databases. Complex queries —with nested subqueries, multiple JOINs, CTEs, and window functions —become unreadable when minified to a single line.

This formatter tokenizes SQL and applies structural indentation:

  • Clause-level indentationSELECT, FROM, WHERE, GROUP BY, HAVING, ORDER BY, LIMIT each start a new line
  • Subquery nesting —parenthesized subqueries are indented one level deeper
  • JOIN alignmentJOIN, LEFT JOIN, ON each on their own line
  • CTE formattingWITH clauses get clean brace formatting
  • Configurable commas —leading commas (preferred by many SQL style guides) or trailing commas

Supports MySQL, PostgreSQL, SQL Server (T-SQL), and SQLite syntax. All formatting happens entirely in your browser —your SQL is never uploaded to a server.