SQL formatter
SQL minify and format in one place: string protection plus optional keyword uppercasing, and multi-statement scripts work as a whole.
Runs in your browserEvery computation happens in your browser — your data never leaves this device.
Result
The result can be copied directly.
Enter SQL to see the result
Characters: 0 · Lines: 0
What this tool does
- Expand a single-line SQL statement from an ORM log into readable structure.
- Collapse formatted SQL back to one line for logs or fixtures.
- Normalise keyword casing so two SQL versions are easy to compare.
Example
Input
select a from t where b = 'x y'
Output
select a from t where b = 'x y'
String literals are masked before minifying, so spaces and `--` inside `b = 'x y'` survive.
Frequently asked questions
Is `--` inside a string treated as a comment?
No. Quote literals are masked into placeholders before comment stripping and restored afterwards, so contents stay byte-identical.
Are keywords uppercased automatically?
In minify mode, yes by default (it can be turned off). Pretty mode keeps your casing and only re-flows.
Does it understand dialects?
It is lexical only and validates no syntax: `::`, `->>`, `LIMIT ? OFFSET ?` and friends are preserved.
Single statement or script?
The whole text is handled as one unit, so semi-colon separated scripts minify fine too.
Keywords:sql formatterformatconverterdeveloper