SQL Query Formatter & Explainer
Format complex SQL queries across dialects, and paste MySQL, SQLite, or PostgreSQL EXPLAIN output to highlight performance bottlenecks.
How to use the SQL Query Formatter & Explainer
Formatter tab
- Paste any SQL query into the input panel.
- Pick a Dialect (Standard SQL, MySQL, MariaDB, PostgreSQL, or SQLite), Indent size, and Keyword case.
- The formatted query appears automatically a moment after you stop typing.
- Copy it to your clipboard or download it as a
.sqlfile.
EXPLAIN Analyzer tab
- Pick a Database (MySQL, SQLite, or PostgreSQL).
- Run
EXPLAIN <your query>(MySQL/PostgreSQL) orEXPLAIN QUERY PLAN <your query>(SQLite) and copy the output — either straight from the CLI or from a GUI client. For MySQL and PostgreSQL, pastingEXPLAIN ANALYZEoutput (instead of plainEXPLAIN) unlocks bottleneck highlighting based on actual runtime — the analyzer detects this automatically from the pasted shape, no extra setting to change. - Paste it into the EXPLAIN output box.
- A table appears with a Severity badge per row — hover any badge to see exactly why it was flagged.
- If the pasted text isn't recognizable as EXPLAIN output for the selected database, an error message explains what's missing instead of failing silently.
How This Tool Works
The Formatter tab uses a tokenizer-based SQL formatter to re-indent your query — it doesn't need to fully parse or understand your schema, so it stays reliable even on complex multi-table JOINs, CTEs, and window functions across five dialects (Standard SQL, MySQL, MariaDB, PostgreSQL, SQLite).
The EXPLAIN Analyzer parses the plan output your database prints for EXPLAIN — MySQL's traditional tabular output, SQLite's `EXPLAIN QUERY PLAN` tree, or PostgreSQL's/MySQL's `EXPLAIN ANALYZE` text tree (auto-detected from the pasted shape, no extra picker) — and re-renders it with a Severity column. For MySQL's classic tabular EXPLAIN, SQLite, and plain PostgreSQL `EXPLAIN` (no `ANALYZE`), each row is checked against a fixed set of well-known performance red flags for that engine (full table scans, missing indexes, filesorts, temporary tables/B-trees) — MySQL's full-scan flags also weigh the estimated row count, so a full scan on a small lookup table isn't flagged the same as one on a huge table. For PostgreSQL and MySQL `EXPLAIN ANALYZE` output specifically, the analyzer instead computes each plan node's own share of total execution time (subtracting out its children's time) and highlights whichever node is the actual bottleneck — the same technique dedicated plan visualizers use.
Everything runs in your browser. Nothing you paste — query or EXPLAIN output — is ever sent to a server.