SQL Minifier
Collapse SQL to a single line for embedding in code or config.
Nothing minified yet
Paste formatted SQL to collapse it onto one line for embedding in application code.
Runs entirely in your browser. Your data isn't uploaded — this page makes no network request with anything you type, which you can verify in your browser's network tab. How this works.
What is the SQL Minifier?
The reverse operation: collapse a formatted query into a single line for embedding in application code, a migration string, a JSON config or a log line. Comments go, runs of whitespace become single spaces, and the statement stays exactly equivalent.
How to use it
- Paste the formatted SQL.
- Choose whether to strip comments and whether to keep the trailing semicolon.
- Press Minify (or Ctrl/Cmd + Enter), then copy the single-line result.
Example
A formatted query collapsed for embedding in code.
SELECT id -- only active rows FROM users WHERE active = true;
SELECT id FROM users WHERE active = true;
Features
- Collapses all insignificant whitespace to single spaces
- Removes line (--) and block (/* */) comments, optionally keeping hints
- Preserves string literals and quoted identifiers byte for byte
- Before/after character counts