Performance · JavaScript and CSS

Unminified CSS

This page loads a stylesheet that keeps all its comments, indentation and white space. Minified, it would download noticeably faster.

How this page is built

The 400 coloured squares below get their colours from unminified.css, a stylesheet written for people to read. Every rule has a comment and generous white space, so a minifier could remove more than half of the file. Every rule is used, so the file is not reported as unused CSS.

Why it matters

Comments, indentation and long names help people edit code, but browsers do not need them. Minifying a stylesheet strips them out, which makes the file smaller and quicker to download, even after compression.

Most stylesheets block rendering, so every kilobyte saved helps the page appear sooner.

How to check it

Run Lighthouse or PageSpeed Insights on the page and look at the diagnostics. Crawl tools that run Lighthouse for each page, or that measure page resources, report the same finding across the site. Lighthouse lists stylesheets that could be minified and the saving for each.

How to fix it

Minify CSS as part of the build, with a tool such as clean-css or Lightning CSS, and keep the readable version in the source files only.

Back to all tests