Developer Tools

SQL Formatter

Format and minify SQL queries for easier reading, sharing, debugging, and documentation.

View all Developer Tools

Continue Workflow

Related tools to try next

All tools
Browser Local No sign-up

Example

Format a compact SELECT query

Readable SQL helps reviewers understand query intent faster.

Input


                        select u.id,u.email,count(o.id) from users u left join orders o on o.user_id=u.id where u.active=1 group by u.id,u.email order by count(o.id) desc
                      

Output


                        SELECT u.id, u.email, count(o.id)
FROM users u
LEFT JOIN orders o ON o.user_id = u.id
WHERE u.active = 1
GROUP BY u.id, u.email
ORDER BY count(o.id) DESC
                      

Practical Notes

How to Use

  1. 1. Paste a SQL query into the input box.
  2. 2. Click Format SQL to make the query easier to read.
  3. 3. Use Minify when you need a compact single-line query.
  4. 4. Copy the output when ready.

Features

Use Cases

Frequently Asked Questions

Which SQL dialects are supported?
The formatter is designed for common SQL syntax used across many databases. Dialect-specific syntax may need manual review.
Does formatting change query behavior?
It should only change whitespace and line breaks, but you should still test important queries in your database environment.
Is my SQL sent to a server?
No. Formatting runs locally in your browser.