Paste a query written as one long line and get it back readable: each clause on its own line, joins and their conditions indented under the table they attach to, subqueries nested visibly, and keywords cased consistently. The query is tokenised before any rule is applied, which matters more than it sounds — the things that break regex-based SQL formatters are all inside tokens. A column aliased 'from where', an apostrophe inside a string, a semicolon in a comment, a T-SQL bracketed identifier containing a reserved word: all of them survive here untouched, because the formatting rules never see inside a token. The minifier is built the same way and deliberately does no final tidying pass over the output, since a whitespace regex across a finished query collapses the spaces inside your string literals and changes your data without telling you. Nothing is uploaded, which matters when the query you are formatting came from production.
| Element | Treatment |
|---|---|
| SELECT, FROM, WHERE | New line at the current indent level |
| GROUP BY, ORDER BY | Recognised as one clause, never split |
| JOIN … ON | Indented one level under FROM |
| AND, OR | Indented as continuations of their clause |
| ( … ) | Raises the indent, so subqueries nest visibly |
| Identifiers | Case preserved exactly as written |
| 'string literals' | Never modified, inside or out |
It should not. Strings, quoted identifiers and comments are tokenised before any rule runs, so their contents are never touched — a column aliased 'select from where' comes out exactly as you wrote it. Formatting only inserts and removes whitespace between tokens; it never rewrites them.
Mainly for quoting. T-SQL uses square brackets for identifiers, MySQL uses backticks, and standard SQL uses double quotes — picking the right dialect means those are recognised as identifiers rather than parsed as something else. The clause structure is the same across all five.
Deliberately. Only recognised SQL keywords are cased; table and column names keep exactly the capitalisation you gave them. Uppercasing identifiers would be wrong on any case-sensitive database and unhelpful everywhere else.
Removes them, since the point of minifying is a single compact line. String literals are kept byte-for-byte — including any whitespace inside them, which is the part most minifiers get wrong.
Yes. Statements are separated at semicolons and each is formatted independently, with a blank line between them.
No. Everything runs in your browser. Queries often contain table names, schema details and sometimes literal customer data — none of it is sent to a server, logged, or stored.
The query is tokenised before any formatting rule runs, which is the difference between a formatter that works and one that corrupts your query. Everything that trips up regex-based formatters lives inside a token: a keyword-looking word inside a quoted string, an apostrophe escaped by doubling or by a backslash, a semicolon inside a comment, a bracketed identifier in T-SQL that happens to contain a reserved word. The tokeniser captures each of those whole, so the casing and line-breaking rules never see inside them. Formatting then walks the token stream: top-level clauses start a new line at the current depth, joins and their ON conditions sit one level in under FROM, AND and OR are indented as continuations, and parentheses raise and lower the indent so subqueries nest visibly. Keyword casing is applied only to words matched against the keyword set, so identifiers keep the capitalisation you gave them, and preserve mode keeps multi-word clauses exactly as typed rather than normalising them. The minifier is built purely from tokens with no final tidying pass over the finished string — running a whitespace regex across the output would collapse the spaces inside your string literals and quietly change the data.