SQL Formatter & Beautifier
Format messy SQL into readable, indented queries with uppercase keywords — or collapse it to a single line. Review risky statements, then copy the right EXPLAIN command for your database. String literals and comments are always preserved.
SQL input
Formatted
Query review (MySQL / MariaDB)
No issues found. The linter checks structure and common risks, not syntax or permissions.
Warnings are heuristics based on the statement text. Always validate destructive changes in a transaction or on a copy before running them against production.
Execution plan command
Run this in your database client to see how the optimizer plans the query.
EXPLAIN ANALYZE select u.id, u.email, count(o.id) as orders from users u left join orders o on o.user_id = u.id where u.created_at >= '2024-01-01' and o.status = 'paid' group by u.id, u.email having count(o.id) > 1 order by orders desc limit 10;
EXPLAIN ANALYZE runs the query and reports actual timings (MySQL 8.0.18+). On older versions use EXPLAIN and check the key and rows columns.
What the formatter does
Keywords — uppercases clauses like SELECT, FROM, and ORDER BY.
Layout — starts each clause on a new line and indents subqueries and parentheses.
Safety — string literals, quoted identifiers, and comments are never touched.
Frequently asked questions
Does it support my database dialect?
Yes. Because literals are protected first, the output is safe across MySQL, PostgreSQL, SQL Server, SQLite, and Oracle. Quoted string prefixes like E'…' and N'…' are handled too.
What does the query review check?
It scans the statement for UPDATE or DELETE without WHERE, SELECT *, comparisons with NULL, trailing commas, unbalanced parentheses, NOT IN (NULL), and dialect mistakes such as LIMIT in Oracle or SQL Server. Treat the results as a safety checklist, not a full SQL parser.
Which EXPLAIN command is generated?
Auto-detect or pick Oracle, PostgreSQL, MySQL, or SQL Server. The tool outputs EXPLAIN PLAN with DBMS_XPLAN, EXPLAIN (ANALYZE, BUFFERS), EXPLAIN ANALYZE, or SHOWPLAN_ALL respectively.
Is my SQL sent anywhere?
No. Formatting and review happen entirely in your browser — paste any query, including ones with sensitive data, without worry.
Why uppercase keywords?
Uppercase keywords make a query's structure (SELECT vs FROM vs WHERE) visible at a glance, which is the convention in most style guides and database documentation.
Related tools
Related tools
More from Developer Tools
Build custom software with us
From internal tools to full platforms — we deliver end to end.