Developer formatter
SQL Formatter
Paste SQL to format it into readable clauses or minify it to one line. Only whitespace and keyword case change, so the query itself stays the same.
Your SQL is processed in the browser and is not uploaded.
Input SQL
Formatted SQL
SELECT u.id, u.name, count(o.id) AS order_count, sum(o.total_amount) AS total FROM users u LEFT JOIN orders o ON u.id = o.user_id AND o.status = 'completed' WHERE u.created_at >= '2026-01-01' AND u.name LIKE 'Ta%' GROUP BY u.id, u.name HAVING count(o.id) > 0 ORDER BY total DESC LIMIT 50;
Only whitespace and the letter case of reserved keywords are changed. Strings, quoted identifiers, comments and numbers are copied exactly, and nothing is inserted between a function name and its "(". Minify removes comments but keeps optimizer hints (/*+ */) and MySQL /*! */ comments. This tool does not check SQL grammar; it only warns about unclosed quotes, comments and parentheses.
Review-friendly SQL
Format SELECT, JOIN, WHERE, GROUP BY, and CASE blocks for code review.
Minify option
Compress a query into one line for examples, fixtures, or log comparison.
Copy output
Copy the formatted SQL into docs, migrations, dashboards, or tickets.
SQL Formatting Notes
Readable diffs
Put major clauses and selected columns on separate lines so query changes are easier to review.
Safe by design
Tokens that touch in your input stay touching (for example COUNT(*) or a::text), so MySQL function calls and PostgreSQL operators keep working.
No grammar check
The formatter does not understand every vendor statement. Unusual syntax is kept as written, possibly on one line.
FAQ
Is SQL sent to a server?
No. Formatting and minifying run in your browser. Nothing you paste is uploaded.
Can formatting change what my query does?
It is designed not to. Only whitespace and the letter case of reserved keywords change. Strings, quoted identifiers, comments and numbers are copied exactly, and the tool checks that the output has the same tokens as the input before showing it.
Can I minify SQL too?
Yes. Minify puts the query on one line and removes comments, except optimizer hints (/*+ */) and MySQL /*! */ comments.
Which SQL dialects are supported?
Choose Standard (PostgreSQL, SQL Server, SQLite and others) or MySQL / MariaDB. The MySQL option understands backslash escapes in strings, # comments and backtick identifiers. PostgreSQL $$ strings and :: casts are kept intact.
Does it validate SQL?
No. It does not check grammar or table names. It only warns about unclosed quotes, comments and parentheses.