SQL Minifier
Compress a SQL script into a compact single line. Comments and spaces go; string literals and quoted identifiers stay exactly as written. It runs in your browser.
- No usage limits
- Your data stays local
- Strings left intact
- Shows size saved
- Runs on your device. Files are never uploaded.
- Free and unlimited. No sign-up, no watermark.
SQL minifier in three steps
No account, no email, no waiting for an upload.
- STEP 01
Add your SQL
A query or a script.
- STEP 02
Set the options
Tick 'Keep comments' if you want them. Tick the backslash option for MySQL strings that use \' inside.
- STEP 03
Copy the one-liner
The note shows the size before and after.
What SQL minifier does, and what it doesn't
We'd rather tell you up front than surprise you after the download.
What you get
- Safe around stringsSingle-quoted strings, double-quoted and backtick names, [bracketed] names and dollar-quoted blocks are never touched.
- Comments handledLine comments (--) and block comments (/* */) are removed. If kept, line comments are converted to block comments so the one-liner still works.
- Hints preservedOptimizer hints like /*+ ... */ and MySQL's /*! ... */ are kept, since they change behavior.
- Spacing trimmed sensiblySpaces around commas and parentheses are dropped while words stay separated.
- MySQL escapesOptionally honor backslash-escaped quotes inside strings.
Good to know
- Not a validatorIt does not check that the SQL is correct.
- Hard to readUse the SQL formatter to expand it again.
- Newlines inside strings stayA line break inside a quoted string is part of the data, so it is preserved and the result may not be one physical line.
Your data never leave your device
The tool runs inside your browser instead of on our servers, so there is nothing to upload, store or delete afterwards.
Typical online tool upload
Your file travels over the internet, sits on someone else's computer for a while, and you wait for the upload and the download.
Mediaextractr no upload
The tool loads into your browser once, then works on your file locally. Nothing is sent, so nothing can leak.
When people use SQL minifier
Put SQL into code or config
Keep a query on one line in an environment variable or JSON field, then escape it.
Send a query in a message
Compact SQL is easier to paste.
Reduce payload size
Trim large generated scripts.
Strip comments before sharing
Remove internal notes from a script.
Mediaextractr vs typical upload tools
| MediaextractrPrivate | Typical upload tools | |
|---|---|---|
| Your file is uploaded | Never | Yes |
| Sign-up needed | No | Often, after a few files |
| Daily file limit | None | Often 1–2 free files |
| Watermark | Never | Sometimes |
| Wait for upload & download | No | Yes |
| Speed on very large files | Depends on your device | Depends on their servers |
What is safe to remove
Whitespace between tokens and comments carry no meaning for the database. Whitespace inside a string does, and so does the exact spelling of a quoted identifier. The minifier walks the text token by token so it can tell the difference.
That is why a plain find-and-replace of double spaces is risky: it can change data inside strings.
Tips: SQL minifier
Before and after minifying:
- Run the formatted version through tests, then minify for transport.
- Keep MySQL's backslash option off unless your strings use backslash escapes.
- Hints in /*+ */ comments stay, because they may be needed.
- Expand again with the SQL formatter.
Where one-line SQL helps
Single-line queries are handy in shell commands, environment variables, JSON or YAML fields, and log lines. For code that is checked into a repo, readable multi-line SQL is usually better. Minify only the copy you hand to a tool, and keep the formatted version as the source of truth.
Questions, answered
How do I minify SQL?
Paste your SQL and copy the compact result. The page shows how many bytes you saved.
Does minifying my query upload it?
No. The minifier runs in this tab, so table names and conditions stay on your device.
Will it change string values?
No. Text inside quotes is left exactly as written.
Are SQL comments removed?
They are removed by default. Tick 'Keep comments' to keep them as block comments.
Does it keep optimizer hints?
Yes. Hints such as /*+ ... */ are always kept.
Can I use it on a phone?
Yes. Paste the query in a current mobile browser and copy the one-liner.