SQL Formatter
Format SQL queries for readable reviews and debugging.
Runs in your browserNothing you type is sent to a server.
Input and result
What you type is kept in this browser only. Reopen to restore your last run.
Use cases
- Pretty-print compact SQL and copy a query review report before running it.
- SQL Formatter for code workflows
Examples
- Common input
select id,name from users where active=1 order by created_at desc- Pretty-print compact SQL and copy a query review report before running it.
- Typical output
Formatted SQL plus query type, table references, clause checks, warnings, and review checklist- Use this as a quick sanity check before copying results.
- Join review
select u.id,o.total from users u join orders o on o.user_id=u.id where o.status='paid'- Formats table aliases, join condition, and filter clauses for review.
- Mutation warning
update users set active=false- Highlights why mutation queries need a WHERE review before running.
- Review report
select p.id,count(*) from payments p join refunds r on r.payment_id=p.id where p.created_at >= '2026-01-01' group by p.id- Creates a copyable report with query shape, tables, clause checks, and execution checklist.
Common mistakes
- Formatting makes SQL readable but does not prove the query is safe or efficient.
- Dialect-specific syntax can be rearranged differently from the database formatter.
- Copied production literals can expose customer IDs, emails, or internal table names.
Before you copy
- 1Review the formatted query against the original before running it.
- 2Redact literals and internal identifiers before sharing the formatted SQL.
- 3Use Text Diff when comparing query revisions after formatting.
Sources
Whitespace and keyword case are free — quoted identifiers are not
In standard SQL, keyword case and whitespace carry no meaning. Quoted identifiers do: the standard and PostgreSQL preserve case inside double quotes, while MySQL uses backticks. Swap the quoting while reformatting and the column stops existing.
Basis: ISO/IEC 9075 (SQL:2016)
Readable is not verified
Formatting only re-indents along the syntax. The execution plan, index use and permissions are untouched — a slow query stays slow. Read EXPLAIN for that.
Basis: Scope of the tool
FAQ
Does SQL Formatter upload my input?
No. This tool runs in your browser unless the privacy badge explicitly says a server route is required.
Can I use this for production secrets?
Avoid pasting sensitive production data into any website. Prefer local test data or redacted payloads.
Does formatting make SQL safe?
No. Formatting improves readability only. Review query type, WHERE clauses, joins, parameters, and database behavior before running it.
Should I paste production SQL here?
Use redacted snippets. Remove customer data, credentials, internal table names, and one-off production literals before sharing formatted output.