SQL-Formatter online
One-line SQL is hard to review. This tool restores its structure: every major clause on its own line, field lists and conditions one per line, JOIN / ON / AND indented by level, and keywords uppercased — subqueries, INSERT, UPDATE and CREATE TABLE follow the same rules.
Indent width (2 or 4 spaces) and keyword casing are both optional, and the output only changes layout, never meaning. Everything runs locally in your browser; your SQL never leaves the page.
Features
- Clause-level breaks — SELECT, FROM, WHERE, GROUP BY, ORDER BY, HAVING, LIMIT and friends each get their own line.
- Condition & JOIN indent — AND / OR / ON nest by level, so multi-table joins and subqueries read cleanly.
- Optional casing — Uppercase keywords or keep the original spelling; identifiers and string literals are never touched.
- Indent width — Switch between 2 and 4 spaces to match your team style guide.
- Multi-statement ready — A whole script is split on semicolons and each statement is formatted on its own.
- Runs locally — Parsing and layout happen in the browser — no upload, no server round-trip.
How to use
- Paste the SQL you want formatted into the left panel — one statement or a whole script.
- Adjust the "GROSSBUCHSTABEN" (uppercase) and Indent options if needed.
- Hit Formatieren (Format) and read the result on the right.
- Copy or download the result and paste it back into your database client.
FAQ
Does this page collect my data?
No. The content is either baked into the HTML at build time or every calculation runs locally in your browser, so your input is never sent to any server. Apart from the footer traffic counters (Baidu Analytics and our self-hosted visitor counter, see the privacy policy), this site collects nothing about your visit.
Does formatting change the meaning of my SQL?
No. Only whitespace and line breaks change: keyword casing, indentation and clause breaks. String literals, comments and identifiers are preserved exactly as written.
Which SQL dialects are supported?
The layout rules target common SQL and cover the usual MySQL, PostgreSQL, SQLite and SQL Server syntax: multi-word keywords (GROUP BY, LEFT OUTER JOIN), qualified names (schema.table) and all three quote styles are recognised.
Why did my comments move?
Line comments (-- and #) and block comments (/* */) are kept verbatim as their own tokens, but the line they sit on is re-indented with the surrounding clause. Comment text itself is never modified.
Why does the comma inside a function not break the line?
Commas inside parentheses are treated as function arguments and stay inline (count(a, b)); only top-level lists such as the SELECT list or GROUP BY break one item per line, so function calls are never torn apart.