Readable SQL in, tight SQL out.
A real parser, not a regex. Beautify messy queries, minify them for transport, strip comments, convert keyword casing, lint for unbalanced brackets, and wrap the result in a string literal for your language. Everything runs locally — nothing is uploaded.
Formatted SQL appears here.
Formatting options
Embed as a string literal
Takes whatever is currently in the output pane and escapes it for your language, quotes and backslashes handled.
—
What this tool does
Format
Tokenises the statement properly, so strings, comments, quoted identifiers and dollar-quoted blocks are never mangled. Clauses break onto their own lines, joins align, subqueries indent, and CASE blocks nest.
Minify
Collapses to the shortest safe form, keeping a space only where removing it would change meaning. Comments can be stripped or kept, and the status bar shows exactly how many bytes you saved.
Case conversion
Keywords, functions and identifiers each get their own casing rule, so you can uppercase SELECT while leaving customer_id exactly as written.
Lint
Flags unclosed brackets, unterminated strings, runaway block comments, trailing commas before FROM, and missing final semicolons — before your database does.
Dialects
Backticks for MySQL, square brackets for SQL Server, $$ blocks and :: casts for PostgreSQL, plus # comments where the dialect allows them.
Keyboard
⌘/Ctrl + Enter format · ⌘/Ctrl + M minify · ⌘/Ctrl + Shift + C copy output · Tab inserts an indent inside the editor rather than moving focus.
Formatting conventions used here
These are the defaults. Every one of them is adjustable in the options panel above.
| Rule | What happens | Why |
|---|---|---|
| Clause keywords | Start a new line at the current nesting level | Makes the shape of a query scannable at a glance |
| SELECT list | One column per line, indented once | Keeps diffs to a single line when a column is added |
| JOIN … ON | JOIN at clause level, ON indented below it | Separates what you're joining from how |
| AND / OR | New line, indented under the condition | Predicate order becomes reviewable |
| Subqueries | Bracket opens, contents indent, bracket closes on its own line | Nesting depth is visible without counting brackets |
| Short brackets | Stay inline when under the wrap width | IN (1, 2, 3) gains nothing from three lines |
| CASE blocks | WHEN and ELSE indent, END returns to the CASE level | Branches line up so a missing one is obvious |
| Statements | Separated by a blank line after each semicolon | Scripts read as a sequence rather than a wall |
Common questions
Is my SQL sent anywhere?
Why minify SQL at all?
Will minifying change how my query behaves?
Does it validate my SQL?
Should keywords be uppercase?
Leading or trailing commas?
What else can you check?
Everything here runs in your browser the same way this formatter does — no upload, no account, no waiting.