In this article
Why CSS size matters
Browsers must download and read CSS before they can show a styled page, which makes stylesheets “render-blocking”. A smaller stylesheet means the first view of the page appears sooner – one of the things measured by Google’s Core Web Vitals, such as Largest Contentful Paint.
What minifying removes
- Comments (
/* … */). - Line breaks, indentation and spaces around
{ } : ; ,. - The last semicolon before a closing brace.
The result looks the same in the browser but is typically 15–30% smaller for hand-written CSS – more if it was heavily commented.
The spaces that must stay
Careless minifiers break styles by removing spaces that matter:
| Case | Must stay as | Why |
|---|---|---|
calc(100% - 20px) | spaces around + and − | Without them, calc() is invalid |
.menu a | space between selectors | It means “a inside .menu” |
content: "Read more" | text in quotes untouched | It is displayed on the page |
margin: 0 auto | space between values | Separate values |
The CSS Minifier handles all of these, and never touches text inside quotes.
License comments
Open-source CSS often requires its copyright notice to be kept. By convention, comments starting with /*! are preserved by minifiers. Tick the option to keep them when you minify third-party code.
How to minify
- Paste your stylesheet into the CSS Minifier.
- Choose whether to keep
/*!license comments. - Copy or download the minified CSS and check the size saving.
- Keep your readable original – edit that, then minify again.
Check before and after
Open the page in your browser, then open developer tools (F12) and look at the Network tab to see the stylesheet’s size before and after. Reload a few key pages – home, a product or article, the contact form – and compare them visually with the old version. Any difference usually points to a selector or calc() expression that needs attention.
On WordPress
Many caching and performance plugins minify CSS automatically. Manual minifying is useful for custom code you add in the Customizer’s “Additional CSS” box, child themes and small static sites. Do not paste minified code into a file you plan to edit later – keep a formatted copy for yourself.
Bigger CSS wins
- Remove unused CSS: themes and frameworks ship styles for components you never use. Removing them often saves far more than minifying.
- Enable compression (gzip or Brotli) on your server – it shrinks CSS dramatically.
- Combine small files to reduce requests, especially on older HTTP/1.1 servers.
- Cache: set long cache times and change the file name or version when it changes.
Do the same for JavaScript
Scripts benefit too – try the JavaScript Minifier. To read minified HTML from another site, format it with the HTML Formatter. Everything runs in your browser.