Stax

SQL Formatter & Beautifier

Format, beautify, and minify SQL queries online.

Clean up messy SQL in seconds

Unformatted SQL queries are hard to read, review, and debug. Paste your raw or minified SQL and this formatter instantly adds consistent indentation, capitalises keywords, and breaks long queries into readable multi-line format.

100% private — no server needed

All SQL formatting runs entirely in your browser. Your database queries, table names, and schema details never leave your device — safe for production SQL with sensitive column names and data.

Frequently asked questions

What SQL dialects are supported?
The formatter handles standard SQL syntax including SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, ALTER, JOIN clauses, subqueries, and CTEs. It works with MySQL, PostgreSQL, SQLite, SQL Server, and Oracle syntax since all share a common SQL core.
What does the formatter do to keywords?
SQL keywords (SELECT, FROM, WHERE, JOIN, GROUP BY, ORDER BY, HAVING, etc.) are uppercased for consistency. This is a widely adopted convention that improves readability by visually separating keywords from identifiers.
Does this send my SQL to a server?
No. All formatting happens 100% in your browser using JavaScript. Your SQL queries never leave your device, making it safe to use with production query strings and sensitive data.
What is SQL minification used for?
SQL minification removes all unnecessary whitespace and comments, producing a single-line query. This is useful for embedding SQL in configuration files, URL parameters, or logging systems where compactness matters.
Can the formatter handle complex queries?
Yes, the formatter handles nested subqueries, multiple JOINs, CTEs (WITH clauses), CASE expressions, and window functions. Complex queries are indented based on clause nesting depth.

Related tools