How to use the CSS Minifier — step by step
Minified CSS is the same CSS with the air taken out: comments gone, extra spaces gone, and the last semicolon in each block dropped. The CSS Minifier does that work for you in your browser, and the five steps below take you from a pasted stylesheet to output you can drop straight into a page. Nothing is uploaded anywhere, so your CSS never leaves your own computer.
At a glance
Step 1: open the tool and look at the sample
When the tool opens, its input box already holds a short sample: two rules for a card, with a comment between them. The result panel already shows the answer for that sample, 35% smaller, with the lines underneath reading Original: 105 characters, Minified: 68 characters, and Saved: 37 characters. That sample is a real result, not a picture of one, and it shows you exactly what the tool does before you paste anything of your own.
Step 2: paste your CSS into the input box
Click in the box headed Your CSS, clear the sample, and paste your own stylesheet. The tool minifies as you type, so there is no button to press and no waiting: every keystroke updates the result at once. You can paste a whole stylesheet, a single rule, or a fragment copied from a page you are working on, and the tool handles all three the same way.
Step 3: read the three numbers
Above the output box the tool shows a big percentage, then three lines: the original size, the minified size, and how many characters were saved. For the default sample those read 105, 68 and 37. The percentage is the share saved, so 37 saved out of 105 is 35%. If your CSS is already tight, with few comments and short lines, the percentage will be small, and that is a result in itself: it tells you there was little to save.
Step 4: copy or download the minified CSS
Press Copy minified CSS to put the output on your clipboard, then paste it where it belongs, such as a style tag or a .css file. If you would rather have a file, press Download .css and the tool saves the minified CSS as minified.css. Either way, the output you copy is exactly what the output box shows, with no extra line added at the end.
Step 5: check the result before you use it
Paste the minified output into a test page and load it. The page should look exactly as it did before, because minifying only removes characters that change nothing: comments, extra spaces, and the semicolon before a closing brace. Check one rule you care about, such as a colour or a width, and if the page looks right, the minified CSS is ready to use.
Worked example
Take the tool’s default sample, which is 105 bytes long. It has two rules, .card and .card .title, and a comment that reads /* a note */. The tool removes the comment, collapses the line breaks and indent spaces, drops the spaces around the braces and colons, and drops the semicolon before each closing brace. What comes out is .card{margin:0;padding:10px;color:red}.card .title{font-weight:bold}, which is 68 bytes. That is 37 bytes saved, or 35% smaller, and the one space that stays is the space between .card and .title, because it is part of the selector: it means a title inside a card, and removing it would change the meaning.
The common mistake
People paste the minified output back into the tool and expect it to shrink again. It will not: minifying the 68-byte sample gives back the same 68 bytes, saving 0. Once the comments and extra spaces are gone, there is nothing left to remove, and running the tool twice is the same as running it once. If the saved figure reads 0 on a second pass, the CSS is already minified, not broken.
Frequently asked questions
How do I minify CSS with this tool?
Paste your CSS into the input box. The tool minifies as you type, shows the bytes saved, and you copy the output with the Copy minified CSS button.
How much does the default sample shrink?
From 105 bytes to 68 bytes, saving 37 bytes, which is 35% smaller.
Is my CSS uploaded anywhere?
No. Everything runs in your browser. Nothing is uploaded, stored or logged.
What happens if I minify the output a second time?
Nothing changes. Minifying the 68-byte sample gives back the same 68 bytes, saving 0, because there is nothing left to remove.
More guides on the CSS Minifier
- CSS Minifier explained with worked examples
- CSS Minifier formula — how it actually works
- CSS Minifier for beginners — start here
- Common mistakes people make with the CSS Minifier
- CSS Minifier vs doing it by hand — which is faster?
- CSS Minifier — the complete guide
- How to get an accurate result from the CSS Minifier
- CSS Minifier for students — with examples
- CSS Minifier for homeowners and DIYers
Try the CSS Minifier — free, in your browser.