SQL Formatter & Beautifier
Format and beautify SQL queries instantly in your browser
Instant SQL formatting
Paste raw or minified SQL and get a clean, indented query in milliseconds. Supports SELECT, INSERT, UPDATE, DELETE, CREATE TABLE and more.
Keyword case control
Choose between UPPERCASE, lowercase or Capitalized SQL keywords to match your team's coding style guide — consistently applied to every query.
No data leaves your browser
All formatting happens client-side in JavaScript. Your SQL queries are never sent to a server — safe for sensitive schemas and production queries.
Frequently asked questions about SQL formatting
Best practices for SQL style, readability and tooling
Unformatted SQL is notoriously hard to read, especially for complex queries spanning multiple tables and joins. Consistent formatting — proper indentation, one clause per line, consistent keyword casing — makes queries easier to review in pull requests, faster to debug, and clearer to share with colleagues.
Uppercase keywords (SELECT, FROM, WHERE) are the traditional SQL convention and remain the most common in enterprise and database environments. Lowercase is gaining popularity in modern projects influenced by ORMs and query builders. Capitalize (Select, From, Where) is a compromise. Pick one style and apply it consistently — this formatter makes switching effortless.
Yes. The formatter handles standard SQL constructs including JOINs, GROUP BY, HAVING, UNION, subqueries, CASE expressions and CTEs (WITH clauses). Each major keyword starts on its own line with consistent indentation, making even deeply nested queries readable.
The formatter supports MySQL, PostgreSQL, SQLite and MSSQL labels as style hints. Since all four dialects share the same core SQL keywords, the formatting rules apply equally well to all of them. Dialect-specific functions or syntax extensions (like PostgreSQL's :: cast or MSSQL's TOP) are preserved as-is without modification.