While testing a free minification toolkit I built for nine formats, I hit a SQL bug: a string containing -- got cut off as if it were a comment. Edge cases like that deserve more weight than benchmark numbers when you're choosing a minifier, so this post covers which tool to pick and when to skip minification entirely.
Does minification still matter if you're already using a bundler?
Mostly no. If your build already goes through Vite, webpack or esbuild, production output is minified automatically, so a separate tool adds a step without adding a benefit.
It still matters wherever that pipeline doesn't reach:
- Plain WordPress and PHP sites with no JS build step. Most of the client work on this portfolio lives here.
- Inline
<style>and<script>blocks, and CMS content editor snippets. - HTML emails. Gmail clips messages over roughly 102KB, and clipped content can hide the unsubscribe link most jurisdictions legally require.
- Embedded widgets, one-off SQL migrations and config files pasted somewhere they'll never see a build tool.
Gzip and Brotli already compress away most of the whitespace savings, so minification's remaining value is parse and compile time on the client, the same budget covered in Core Web Vitals for WordPress.
Which JS and CSS minifier should you use?
Inside a build pipeline, Terser is the safe default. Most bundlers and WordPress minification plugins use it under the hood. If build speed matters more than squeezing the last 1 to 2% out of the bundle, esbuild or SWC are dramatically faster. If output size is the priority and speed isn't, uglify-js often produces the smallest output by a small margin, just far slower (see these minification benchmarks). For CSS, cssnano (or clean-css) covers the same ground, and html-minifier-terser handles HTML.
These tools don't always agree on edge cases, and a wrong call silently changes what your code does. A naive SQL minifier, for instance, will happily strip this as a comment:
SELECT * FROM orders WHERE note = 'Use code SAVE10 -- expires soon';
That -- is inside a string literal, so it isn't a comment, and a minifier that doesn't track string boundaries truncates the rest of the query.
I hit this exact bug while auditing my own toolkit before launch, along with a handful like it: an HTML minifier's internal placeholder colliding with literal user text, and an XML minifier collapsing whitespace inside a text node. The fix was the same every time. Protect string and text content before any comment-stripping or whitespace-collapsing runs, and test any minifier against your own code before it touches production.
What if you just need to minify one file, right now?
If Node.js isn't open, or you just need to shrink a snippet before pasting it somewhere, a bundler doesn't help. That gap called for a zero-install tool rather than a lighter bundler, so I built MinifyAssets: CSS, JavaScript, HTML, JSON, XML, SQL, YAML, SVG and Markdown, all minified entirely in the browser. Nothing is uploaded to a server, so you can paste in something you wouldn't give a random online tool. There's no server on the other end.
Rule of thumb
Let the bundler minify whatever already runs through it, and keep a reliable standalone tool for everything outside the pipeline. Don't spend time shaving milliseconds a bundler already handles. Spend it on the code that sits outside the pipeline.


