Formatters
SQL Formatter
SQL format is a courtesy to the next person — often you, in six months. Clauses on their own lines, keywords in a consistent case, joins that do not hide at the end of a 400-character line. For the query in your paste buffer, not a warehouse migration framework.
Drop a file on the left. Drafts stay in this browser. Shortcut: Ctrl or Cmd + Enter to run.
How this sql formatter works
- Paste or drop a .sql file into the input on the left.
- Flip options if you see them (comments, indent, case). Defaults are the safe ones.
- Hit Run, or Ctrl / Cmd + Enter. Leave “Process on server” off unless you mean it.
- Read the status line, then copy, download, or jump to a related tool.
Readable SQL is safer SQL
You catch a missing WHERE when FROM sits on its own line. You see a cartesian join when JOIN is not buried. Formatting will not add an index. It will make the review possible.
String literals and comments are not playgrounds. The minifier exists when you need a compact log line. Use format for humans, minify for transport.
Frequently asked questions
What does an SQL formatter change?
Mostly layout and keyword casing. select id,email from users where active=1 becomes SELECT / FROM / WHERE on separate lines. The plan your database chooses does not care. Your reviewer does.
Will formatting SQL make it faster?
No. Indexes, predicates, and join order make it faster. Format makes a missing WHERE obvious because FROM users is no longer hiding at column 180. That prevents a slow query by preventing a wrong query.
Example?
Before: select u.id from users u join posts p on p.user_id=u.id order by p.id desc. After: JOIN and ORDER BY get their own lines, so you can see whether you meant LEFT JOIN.
Fun SQL fact?
Fun fact: SELECT * is convenient and also how you accidentally serialize a password_hash column into an API. Format will not stop you. Reading the column list might.
Are keywords case-sensitive?
Usually no. select and SELECT are the same in PostgreSQL, MySQL, SQL Server for keywords. Quoted identifiers ("User") can be sensitive. Format the keywords; do not “helpfully” lowercase your quoted table names.
Should I format SQL in migrations?
Yes if humans review them. Some teams keep compact SQL in generated migrations — then format in the PR description. Either way, do not minify production queries as a performance strategy. That is not how engines work.
Can a formatter break string literals?
It must not wrap inside 'O''Brien'. Apostrophes in SQL strings are data. If a tool splits a string across lines without escaping, throw the output away.
SQL format vs SQL minify?
Format for humans and git diffs. Minify when you need a single-line log or a compact embed. Same query. Different audience.