General dev

SQL Formatter

Runs locally

Use SQL Formatter

What it does

Make a long one-line SQL query readable: clause keywords such as SELECT, FROM, JOIN and WHERE start new lines and comma-separated columns line up. Minify does the reverse.

It runs entirely in your browser: nothing you enter is uploaded.

Example

One-line join query

Input
SELECT d.domain, r.reported_at FROM reports r JOIN domains d ON d.id = r.domain_id WHERE r.status = 'open' AND r.score > 80 ORDER BY r.reported_at DESC LIMIT 20
Output (captured 2026-10-20)
SELECT d.domain,
       r.reported_at
FROM reports r
JOIN domains d
ON d.id = r.domain_id
WHERE r.status = 'open'
AND r.score > 80
ORDER BY r.reported_at DESC
LIMIT 20

SELECT, FROM, JOIN, ON, WHERE, AND, ORDER BY and LIMIT each start a new line, and the two selected columns go on separate lines.

FAQ

How does it decide where to break lines?

It looks for a fixed list of 40 keywords and phrases (SELECT, FROM, JOIN, ON, WHERE, AND, OR, AS, IN, GROUP BY, ORDER BY, LIMIT and others), starts a new line before each one and upper-cases it, and adds a line break after every comma. It does not parse SQL, so there is no syntax check and subqueries are not indented.

Can formatting change what my query does?

Yes, in two cases. Keywords and commas inside quoted strings are changed too (WHERE note = 'select from' gets line breaks inside the string), and Minify keeps -- comments, which then hide the rest of the one-line query. Check string literals and remove line comments before you use the result.

Is my SQL sent to a server?

No. Formatting is a set of text replacements done in your browser; the query is not uploaded or stored.