SQL Formatter
Beautify and format SQL queries with configurable keyword casing and indentation.
About SQL Formatter
SQL Formatter cleans up cramped, one-line queries into readable, consistently indented SQL with the keyword casing you prefer. Paste a query you pulled from a log, an ORM dump, or a colleague's message and get back something you can actually read and review. It runs entirely in your browser, so production queries and table names never leave your machine.
- Category
- dev
- Input
- Accepts: text/plain or application/sql.
- Output
- Outputs: text/plain.
- Cost
- Free, runs in your browser
- Memory
- low
Common uses
- Reformat a single-line query copied out of an application log so you can spot the JOIN that's missing an ON clause
- Standardize uppercase keywords (SELECT, FROM, WHERE) across a PostgreSQL migration file before committing it
- Make a generated ORM query human-readable to confirm it's hitting the index you expect
- Tidy up a teammate's SQL pasted into a chat message before pasting it into a pull request description
- Indent a deeply nested subquery so the correlation between inner and outer SELECTs is obvious
- Normalize mixed-case keyword styling across a folder of MySQL scripts so diffs stay clean
Frequently asked questions
Which SQL dialects does it handle?
It formats standard SQL and works well with PostgreSQL, MySQL, and SQLite syntax. It reformats structure and casing rather than validating dialect-specific semantics, so vendor-specific functions pass through untouched.
Does my query get uploaded anywhere?
No. Formatting happens locally in your browser, so the SQL, table names, and any literal values in the query never touch a server.
Can I control keyword casing and indentation?
Yes. You can choose how keywords are cased (for example forcing uppercase) and set the indentation, so output matches your team's style guide.
Will it change what my query does?
No. It only adjusts whitespace, line breaks, and casing of keywords. The logic, identifiers, and string values stay exactly as you wrote them.
Is there a length limit on the query?
There's no fixed cap. Very large multi-statement scripts format fine; the practical limit is your browser's memory, which is generous for text.
Keywords
- sql
- format
- beautify
- query
- database
- postgresql
- mysql
- sqlite