Format SQL for Code Review
Format SQL queries with readable indentation for reviews and debugging.
Try it now
Try it now
Open SQL Formatter with a ready-to-run example.
When you need this
- You need to review a long SQL query quickly.
- You are debugging performance issues in complex SQL.
- You want a consistent SQL style before sharing.
How to do it with Daily Developer Tools
- Paste SQL into the SQL Formatter input.
- Choose keyword casing and indentation style.
- Copy the formatted output for review.
Tips / common pitfalls
- Break long SELECT lists onto new lines for readability.
- Use consistent keyword casing (UPPER) in teams.
- Format before adding comments to reduce churn.
Examples & test data
Simple SELECT
Input example
select id,name,created_at from users where status='active' and created_at >= '2025-01-01' order by created_at desc;
Expected output
SELECT id, name, created_at FROM users WHERE status = 'active' AND created_at >= '2025-01-01' ORDER BY created_at DESC;
Join with filters
Input example
select o.id, o.total, c.name from orders o join customers c on o.customer_id = c.id where o.status = 'paid' and o.total > 100;
Expected output
SELECT o.id, o.total, c.name FROM orders o JOIN customers c ON o.customer_id = c.id WHERE o.status = 'paid' AND o.total > 100;
FAQ
Is this a full SQL parser?
It is a lightweight formatter aimed at common SQL patterns.
Can I change keyword casing?
Yes. Choose upper or lower case keywords.
Does it support multi-statement SQL?
Yes, it formats each statement in sequence.
Is my SQL uploaded?
No. Formatting runs locally in your browser.
Related tools
Privacy-first: everything runs locally in your browser. No uploads, no tracking of your inputs.