Why it matters
Queries copied from logs, ORMs or monitoring tools arrive as one long line. Reading a 40-column join like that is the quickest way to miss a wrong condition.
This formatter tokenises the SQL properly, so strings, quoted identifiers and comments are never changed, then lays it out with each clause on a new line and AND/OR conditions indented under it. Subqueries and CTEs nest, which makes the structure of a complex query obvious.
How it works
- InputSQL from a log, an ORM or a colleague
- In your browserTokenised with strings and comments kept intact
- OutputFormatted or minified SQL with a summary
Where it fits in a designer's workflow
- Plan
- Design
- Build
- Test
- Launch
By the numbers
Show the numbers as a table
| Version | Bytes | Lines |
|---|---|---|
| As pasted | 722 | 2 |
| Formatted | 832 | 49 |
| Minified | 677 | 1 |
How to use it
- Paste your SQL.
- Choose the keyword case and indent.
- Read the formatted query.
- Copy or download it, or minify it instead.
FAQ
Which dialects work?
The common syntax shared by PostgreSQL, MySQL, SQLite and SQL Server, including backtick, double-quote and bracket identifiers.
Will it change my query?
Only whitespace and, if you choose, keyword case. Strings and names are left exactly as written.
Does it check the SQL is valid?
It checks the brackets and quotes balance, but it doesn't run or validate the query against a database.
Can it format several statements?
Yes. Separate them with semicolons and each is formatted in turn.