SQL Minifier
Compress SQL onto one line, stripping comments and extra whitespace.
Sometimes a formatted SQL query needs to become a single line: embedding it in a JSON config, a code string, a log-analysis tool, or a one-off command. Manually collapsing multi-line SQL risks joining a `-- comment` into the following clause and silently breaking the query.
This minifier strips SQL comments (both `--` line and `/* */` block styles) and collapses whitespace to single spaces — while carefully preserving the contents of string literals and quoted identifiers, so a comment marker or newline inside a quoted value survives intact.
How to use SQL Minifier
- 1
Paste your SQL
A formatted query or script.
- 2
Review the single-line output
Comments removed, whitespace collapsed.
- 3
Copy the result
Ready to embed in code or config.
Features
- Removes -- line and /* */ block comments
- Preserves string and quoted-identifier literals
- Collapses whitespace to a single line
Frequently asked questions
Common mistakes to avoid
- Minifying SQL that relies on `--` comments for line separation without spaces — always keep a space or newline after `--` in the source.
- Storing only the minified version — keep the readable, formatted query as your source of truth.
Get new tools in your inbox
One email a month with new tools, guides, and updates. No spam, unsubscribe anytime.

