SQL Formatter
Beautify SQL queries with consistent indentation and line breaks.
Processed on your device. Files are not uploaded
How to format SQL
Paste your SQL
Paste or type your SQL into the box.
Format
The query is laid out with consistent indentation and line breaks.
Copy the result
Copy the result, or use it straight away.
Worked example
This is what SQL Formatter gives for its own sample values. Open the tool above and change anything to try your own.
SQL
select u.id, u.name, count(o.id) as orders from users u left join orders o on o.user_id = u.id where u.active = 1 group by u.id, u.name order by orders desc limit 10;
Formatted
SELECT u.id, u.name, count(o.id) as orders FROM users u LEFT JOIN orders o ON o.user_id = u.id WHERE u.active = 1 GROUP BY u.id, u.name ORDER BY orders desc LIMIT 10;
About SQL Formatter
Make a long SQL query easy to read, with clear indentation and line breaks. It helps when you review a query or share it.
FAQs
Does it change what the query does?
No. Only the layout changes.
Does it run the query?
No. It only formats text.