CSS Minifier for homeowners and DIYers
Homeowners and DIYers do not only build with timber and paint: many also build a small website, a renovation blog, or a page for a side job, and every one of those has a stylesheet that can be made smaller. The CSS Minifier does that in seconds, so a page for customers loads faster, and the examples below use the same short stylesheets a home project site would.
At a glance
A services page for a side job
If you do weekend work, such as gardening, painting or small repairs, a simple services page helps customers find you. Its stylesheet might be a page block of four rules, with a comment, at 186 bytes. Minified, it becomes .page{font-family:Georgia,serif;line-height:1.6;color:#333}.page h1{font-size:28px;margin-bottom:12px}.page p{margin-bottom:16px}, which is 129 bytes, saving 57 bytes, or 31% smaller. Paste your own stylesheet into the tool, copy the output, and use it in place of the original: the page will look exactly the same, and the file your customers download will be smaller.
A renovation blog post layout
A renovation blog post is usually a page with a heading, some text, and photos of the work in progress. The heading rule matters here: the space between .page and h1 must survive minifying, because it means a heading inside a page, and the tool leaves it alone. The comment /* header styles */ disappears, which is fine, because it was a note for you, not something visitors need. Check the page after minifying: the headings, the text spacing and the photos should all sit exactly where they did before.
A button for a quote request
A quote request button is the part of the page that earns you work, so its rule is worth getting right. Written over five lines, it is 45 bytes:
.btn {
color: blue;
background: white;
}Minified, it becomes .btn{color:blue;background:white}, which is 33 bytes, saving 12 bytes, or 27% smaller. The colour and the background are unchanged, so the button looks the same. If you change the colour later, change it in your readable original and minify a fresh copy, rather than editing the single long line of minified CSS.
A hero image with a file name that has a space
Photos from a phone often have file names with spaces in them, such as "my photo.jpg", and a hero section often sizes itself with calc(). This rule has both, and it is 91 bytes. Minified, it becomes .hero{background:url("my photo.jpg");width:calc(100% - 20px);margin:0 auto}, which is 75 bytes, saving 16 bytes, or 18% smaller. The space in the file name survives, because the tool copies quoted strings untouched, and the spaces around the minus sign in calc(100% - 20px) survive too, so the image still loads and the width still works out.
Keep the original safe
The one habit that matters is keeping your readable stylesheet. Save the minified output under a different name, such as style.min.css, and keep the original, with its comments and line breaks, as the version you edit. That way a later change, such as a new paint colour or a different font, means editing the original and minifying again, which takes seconds, instead of rebuilding a stylesheet from a single long line.
The common mistake
Homeowners sometimes publish a half-finished site and then minify the CSS as a last step, hoping it will fix a layout that never looked right. Minifying only removes dead weight: it cannot fix a rule that was wrong to begin with, and it cannot make a page look good. Get the page looking right first, with the readable CSS, and only then minify a copy for publishing.
Frequently asked questions
How much does a project page stylesheet shrink?
From 186 bytes to 129 bytes, saving 57 bytes, which is 31% smaller.
How much does a button rule shrink?
From 45 bytes to 33 bytes, saving 12 bytes, which is 27% smaller.
Will minifying break a photo file name with a space?
No. Strings in quotes are copied untouched, so "my photo.jpg" keeps its space.
Should I keep my original stylesheet?
Yes. Save the minified output as style.min.css and keep the original, so you can edit it later and minify a fresh copy.
More guides on the CSS Minifier
- How to use the CSS Minifier — step by step
- 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
Try the CSS Minifier — free, in your browser.