
Shrink CSS, JavaScript or HTML with real parsers, read original, minified and gzip sizes, and avoid breaking code on the way to production.
You are handing a small marketing site to a client and the stylesheet still carries every comment, indentation and 0px you typed while building it. You have no build pipeline on this project, just files on a host. CSS JS Minifier gives you a smaller version to paste or download, and tells you the size before and after.
Pick CSS, JavaScript or HTML, paste code or upload a file, and the minified output appears on the right after a short pause. Under it you see the original size, the minified size and the gzip size.
Paste a small card component into the CSS tab: a commented .card rule with background-color: #ffffff, a hover shadow with rgba(0, 0, 0, 0.1), a heading rule with margin-top: 0px, and two blank lines between rules. That input is 313 bytes. The output reads .card{background-color:#fff;border:1px solid #e5e7eb;...} and margin: 0px 0px 16px 0px collapses to margin:0 0 16px. It comes to 218 bytes, which the label shows as 30% smaller.
Look at the gzip figure next. The original compresses to about 216 bytes and the minified one to about 182. Servers usually send text compressed, so the gzip numbers are closer to what a visitor downloads. Minifying still helps, but by 34 bytes rather than 95. The honest summary is that comments and whitespace compress well anyway, so the gain on the wire is smaller than the headline percentage.
For JavaScript, a 212-byte function with a comment, long names and Math.round(total * 100) / 100 becomes 94 bytes: function addTax(n,o){const a=n+n*o/100;return Math.round(100*a)/100}console.log(addTax(89,8));. Local names such as price and ratePercent were shortened, while the top-level function name stayed. In the test I ran, a function exposed on window kept its public name too.
CSS mode uses a CSS optimiser that merges and shortens rules. JavaScript mode compresses the code, shortens local variable and parameter names, and removes dead code and comments. HTML mode collapses whitespace, removes comments, drops redundant attributes and script or style type attributes, shortens the doctype, and minifies inline CSS and JavaScript. Attribute quotes and optional tags are left alone, and conditional comments stay.
Whitespace inside pre and textarea elements is preserved, so a code sample on the page keeps its layout.
styles.min.css, script.min.js or index.min.html depending on the mode.Invalid code produces a red message with a line and column, for instance an unclosed brace in a stylesheet or an unexpected token in a script. No output appears until the parser can read the input, so fix the spot named. This is a handy side effect: a missing semicolon or bracket you did not know about gets reported before deployment.
.min file next to it.Keep the working source in a src folder and the minified output in the folder you upload. After each edit, repeat the paste and download, rename nothing by hand, and compare the file dates so you never publish a stale .min file. On the host, open the live page in a private window to bypass cached copies, check the browser console for red errors, and scroll the whole page once. If something looks wrong, swap the readable file back in and compare, which takes a minute when the source is still beside it.
HTML mode deserves the same care on templates. Server-side placeholders inside a template are not real HTML, so minify only the rendered output of a page, not the template that produces it.
When you need a fingerprint for cache busting or integrity checking, Hash Generator produces a digest of the file text, and Base64 helps when you inline a tiny asset in CSS as a data URI. Both fit the same deploy checklist in the security tools category.
The tool processes the code in your browser, so a stylesheet with unreleased class names does not go to a server for minification. Your 10 trial usages a day are enough for a stylesheet, a script and a page of HTML.
Which file do you minify most, CSS, JavaScript or whole HTML pages? Tell us on the contact page.