Quick Answer
A SQL formatter takes a dense, single-line query and lays it out so each clause (SELECT, FROM, WHERE, JOIN…) starts on its own line, keywords are uppercased, and parentheses indent properly. Readability without changing what the query does.
What This Tool Does
The formatter tokenizes your SQL — respecting string literals so it never touches their contents — then rebuilds it with keywords uppercased, major clauses on fresh lines, commas grouped, and parentheses indented. A trailing semicolon ends cleanly.
Key Features
- Keyword uppercasing —
selectbecomesSELECTfor a consistent style. - Clause-per-line —
FROM,WHERE,GROUP BY,ORDER BYstart their own lines. - Paren-aware — subqueries indent by depth.
- String-safe — quoted literals are preserved exactly.
How to Use the SQL Formatter
- Paste your SQL into the input box.
- Read the formatted query on the right — updates live.
- Copy or download the result.
Use Cases
- Reviewing a long query pulled from logs or an ORM.
- Standardizing query style across a team’s shared snippets.
- Reading nested subqueries and CTEs without squinting.
Tips
- String literals containing words like "from" are safe — the formatter tracks quotes.
- For CTEs, check the indentation of the
WITHblock once; deep nesting can still be dense.
Privacy
Formatting happens locally — your queries never leave the browser.
Conclusion
SQL is easier to trust when you can read it. Format any query here in seconds — free and private.