SQL Formatter
Beautify SQL queries with line breaks and indentation. Free, private and instant.
How to use the SQL Formatter
- Paste your SQL statement into the box.
- Keywords are upper-cased and main clauses start on new lines as you type, with Copy and Download .txt buttons.
Example
Worked example (fictional query, run through this tool)
- Input: 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 order by orders desc limit 10
- Result: SELECT u.id, u.name, COUNT(o.id) AS orders, then FROM, LEFT JOIN, WHERE, GROUP BY, ORDER BY and LIMIT each on their own line
Limitations
- It is a simple formatter based on text rules, not a full SQL parser, so unusual dialect syntax may be formatted imperfectly.
- Spacing around operators is not always normalised (for example o.user_id=u.id is kept as typed).
- It does not check that the SQL is valid or run it.
About this tool
Format SELECT, INSERT, UPDATE and DELETE statements so clauses start on their own lines and keywords are uppercase.
SQL Formatter is part of ToolStack Hub's Developer Tools. It runs entirely in your browser, which keeps your data private and makes results instant. There is nothing to install and no account to create. There is no usage limit.
Frequently asked questions
Is the SQL Formatter free?
Yes. SQL Formatter is completely free with no sign-up, limits or watermarks.
Is my data private when I use the SQL Formatter?
Yes. It runs in your browser, so your input is not uploaded to our servers.
Does it work on mobile?
Yes. ToolStack Hub tools work on phones, tablets and desktop browsers.
Keep going
Need this automated for your business?
Vantalume builds custom AI and web automation workflows so your team can stop doing repetitive work.