SQL Formatter

Works offlineNothing is uploadedFree, no sign-up

Formatting runs in this tab — your query is never sent anywhere.

Paste a query, get it back readable: keywords uppercased, every major clause on its own line, select lists broken at the commas. Strings and comments come through byte for byte — a formatter that edits your literals is a formatter that breaks your query.

Why formatted SQL matters

SQL is one of the few languages regularly written in one line by machines and then read by humans in an incident at 2 a.m. The formatter's whole job is that moment: clause per line means the WHERE you are hunting is at the left margin, and a comma-broken select list means the missing column is visible instead of buried in position 14 of 30.

The one rule that separates a safe formatter from a dangerous one is literal preservation. This one tokenises strings, quoted identifiers and both comment styles before touching anything, so what is data stays data.

Frequently asked questions

Does it change what the query does?

No. It only moves whitespace and changes keyword case — both meaningless to every SQL engine. String literals, quoted identifiers and comments are tokenised first and passed through untouched, so a WHERE inside a string stays exactly as you wrote it.

Which dialects does it understand?

The shared core: SELECT/FROM/WHERE/GROUP BY/ORDER BY, the JOIN family, INSERT/UPDATE/DELETE, UNION. That covers the queries people actually paste. Dialect-specific syntax it does not recognise simply stays on the line it was on — never mangled, just not specially indented.

Why do keywords become uppercase?

Convention with a purpose: SQL has no reserved-word highlighting of its own, so case is the one signal that separates structure from data in a plain-text query. Every style guide from Oracle's to SQLite's docs writes keywords in caps for exactly this reason.

Is my query uploaded for formatting?

No — the formatter is a few kilobytes of JavaScript running in this tab. Queries routinely contain table names, business logic and sometimes literal customer data; that is precisely the kind of text that should never travel to someone else's server for prettifying.

Related tools