SQL Query Formatter
Turn messy, single-line SQL into clean, readable queries.
Your SQL
Paste a messy or single-line query.
Formatted
Keywords uppercased, clauses and lists broken onto their own lines.
SELECT o.id, o.created_at, u.name, u.email, SUM(oi.price * oi.quantity) AS total FROM orders o INNER JOIN users u ON u.id = o.user_id LEFT JOIN order_items oi ON oi.order_id = o.id WHERE o.status = 'completed' AND o.created_at > '2024-01-01' GROUP BY o.id, o.created_at, u.name, u.email ORDER BY o.created_at DESC LIMIT 50;
About this tool
Paste a cramped or single-line SQL query and get it reformatted into clean, multi-line SQL with uppercase keywords, one column per line, and clauses broken out — or collapse it back into a single line to paste into a config or log statement.
How to use SQL Query Formatter
- 1
Paste any raw or single-line SQL query into the input box.
- 2
The formatted version — uppercase keywords, one item per line — appears instantly on the right.
- 3
Copy the formatted version, or the single-line version if you need to paste it somewhere compact.
Frequently asked questions
Related tools
JSON Tree Formatter & Syntax Validator
Turn messy or broken JSON into a clean, color-coded tree.
WCAG Typography Readability Checker
Check if your text and background actually pass accessibility standards.
CSS Grid & Flexbox Live Layout Playground
Adjust sliders, watch the layout update, copy the CSS.