SQL Formatter

Format and beautify SQL queries with proper indentation and keyword highlighting.

Input SQL

Formatted SQL

SELECT u.id, u.name, u.email, o.order_id, o.total
FROM users u INNER
JOIN orders o ON u.id = o.user_id
WHERE u.created_at >= '2024-01-01'
  AND o.status = 'completed'
GROUP BY u.id, u.name, u.email, o.order_id, o.total
HAVING o.total > 100
ORDER BY o.total DESC
LIMIT 50;

Supported SQL Statements

SELECT queries
INSERT statements
UPDATE statements
DELETE statements
JOINs (INNER, LEFT, RIGHT)
GROUP BY / ORDER BY
HAVING clause
UNION / UNION ALL

Tip: Well-formatted SQL is easier to read, debug, and maintain. Use consistent formatting across your team.