100% client-side, nothing ever leaves your browser
Format & Beautify SQL
Paste a SQL query and get clean, properly indented output with your choice of dialect and keyword casing — or minify it into a compact single line.
How SQL formatting works
A dedicated SQL formatting library tokenizes your query and rebuilds it with consistent indentation and line breaks, entirely in your browser.
Paste your SQL
Paste any query — a simple SELECT or a multi-join statement with subqueries and CASE expressions.
Choose dialect and case
Pick the SQL dialect that matches your database and your preferred keyword casing.
Copy or download
Copy the formatted query or download it as a .sql file.
Privacy note: formatting runs entirely in your browser using a JavaScript library loaded from a CDN. Your SQL is never uploaded, logged, or stored on a server.
Common uses
Reviewing generated queries
ORMs and query builders often produce single-line SQL; formatting it makes reviewing and debugging much easier.
Preparing SQL for documentation
Consistently formatted SQL is easier to read in code reviews, wikis, and pull requests.
Standardizing team style
Use a consistent keyword casing and indentation style across a team without manual reformatting.
Shrinking queries for storage
Minify a formatted query back down before storing it as a compact string in application code.
Frequently asked questions
Which SQL statements does this formatter support?
It handles common statements including SELECT, INSERT, UPDATE, DELETE, CREATE, ALTER, JOIN, WHERE, GROUP BY, ORDER BY, HAVING, LIMIT, and CASE expressions, across several SQL dialects.
Which SQL dialects are supported?
You can format standard SQL, MySQL/MariaDB, PostgreSQL, SQLite, and a few other dialects, since keyword sets and quoting conventions differ slightly between database engines.
Can I control keyword casing?
Yes. You can format keywords like SELECT and WHERE in uppercase, lowercase, or leave them exactly as you typed them.
What does minify do?
Minify strips comments and collapses extra whitespace down to single spaces, while leaving string literals untouched, producing a compact one-line version of the same query.
Is my SQL uploaded anywhere?
No. Formatting runs entirely in your browser using a JavaScript SQL formatting library loaded from a CDN. The SQL you type is never sent to a server.
Why does my formatted query look different from what I expected?
SQL formatting involves stylistic choices, like where to break lines around JOIN or CASE. If the layout doesn't match your preference, try a different dialect setting, since formatting rules can vary slightly between them.
More tools
Additional utilities from the same toolkit. Want consistent style conventions? Read the SQL Formatting & Style Guide →