SQL Formatter & Prettifier
Paste a one-line query to get readable, indented SQL with consistent keyword casing — ready to paste back into your codebase.
SELECT id, name, email FROM users u JOIN orders o ON o.user_id = u.id WHERE u.active = 1 AND o.total > 100 ORDER BY o.total desc LIMIT 20
100% private
This tool runs entirely in your browser. Nothing you type is uploaded, logged or stored.
Query Readability, Debugging Efficiency and Clean Code Standards
Most production SQL arrives as a single unbroken line pulled from an ORM log, a slow-query report or a stack trace. In that form even a short join is hard to reason about, and a mis-scoped WHERE clause or a missing join condition can hide in plain sight until it returns duplicated rows or scans an entire table.
Formatting fixes that for free. Placing each clause on its own line makes the query shape visible: how many tables are joined, where filters apply, whether an aggregate has a matching GROUP BY. Indenting conditions under AND and OR exposes boolean precedence problems, the single most common cause of silently wrong result sets. Uppercase keywords separate language syntax from your own identifiers, which is the convention most style guides and code reviewers expect in MySQL, PostgreSQL and SQLite projects alike. Format before you commit a migration, before you paste a query into a ticket, and before you hand anything to a teammate for review.
Frequently asked questions
The formatter works on standard SQL syntax shared by MySQL, PostgreSQL, SQLite, SQL Server and MariaDB. Dialect-specific functions are left untouched.