SQL Formatter
Pretty-print a one-line SQL query into readable, indented multi-line SQL.
Breaks a dense, single-line SQL query into a readable multi-line layout — each major clause (SELECT, FROM, WHERE, JOIN, ORDER BY, and similar) starts its own line — using keyword-based formatting rather than a full SQL parser, so it works across dialects but won't understand every vendor-specific construct perfectly.
Example: "select id, name from users where active = 1 order by name" becomes a 3-line query with SELECT, FROM, and ORDER BY each on their own line.
How it works
- Paste a SQL query, however it's currently formatted
- Major clauses (SELECT, FROM, WHERE, JOIN, and more) are broken onto their own line, instantly on your device
- Copy the readable result
Frequently asked questions
Does this validate that my SQL is correct?
No — it only reformats based on keyword matching, without parsing or checking syntax. A query with a typo or logic error will be reformatted just as readily as a correct one.
Is my data uploaded anywhere?
No — SQL Formatter runs entirely in your browser using JavaScript/WebAssembly. Your data is never sent to a server.
Does this work for any SQL dialect — MySQL, PostgreSQL, T-SQL?
Yes for basic formatting, since it works by recognizing standard keywords rather than parsing a specific dialect's grammar — vendor-specific syntax still gets broken onto new lines correctly even though it isn't specifically validated.