CSS performance: size, selectors and rendering cost

CSS blocks the first paint and also drives style, layout and paint work. How its size, loading, selectors and animations affect speed, and what to fix first.

IntermediateHow-to5 min readUpdated October 30, 2026

In this guide
  1. Four ways CSS costs time
  2. Fix 1: send less CSS
  3. Fix 2: load it well
  4. Fix 3: keep matching and invalidation small
  5. Fix 4: use cheap properties, and let the browser skip work
  6. Fix 5: keep it small as the site grows
  7. How to measure it
  8. Check your own page
  9. Sources

Four ways CSS costs time

1. It blocks rendering. MDN states that CSS is treated as a render-blocking resource by default. The browser will not draw any content until the CSS Object Model is built, because a later rule can override an earlier one. That makes the CSS in the head the file that decides when the first paint can happen. See critical CSS and render-blocking files.

2. It adds bytes. In the 2025 Web Almanac the median mobile home page loaded 77 KB of CSS in 8 files, and at the 90th percentile pages made around 30 CSS requests. The weight is small next to images and JavaScript, but it all sits on the critical path.

3. It has to be matched. Whenever the page changes, the browser works out which rules apply to which elements. web.dev explains that this is roughly half matching selectors and half building the resulting style, and that the worst-case cost grows with the number of elements multiplied by the number of rules.

4. It decides how much work a change causes. MDN groups CSS properties by what they trigger. Those that change geometry or position, such as left, max-width, border-width, margin-left and font-size, cause recalculation, layout and repaint. Those that only change appearance, such as color, cause recalculation and repaint. A few, transform and opacity among them, can be handled in their own layer and cost only the recalculation.

Fix 1: send less CSS

Start where the saving is largest.

Fix 2: load it well

<link rel="stylesheet" href="/css/site.css">
<link rel="stylesheet" href="/css/print.css" media="print">
<link rel="stylesheet" href="/css/wide.css" media="(min-width: 1200px)">

Fix 3: keep matching and invalidation small

Fix 4: use cheap properties, and let the browser skip work

Fix 5: keep it small as the site grows

CSS grows by accumulation. Nobody deletes a rule when a feature is removed.

How to measure it

What to checkWhere
Is CSS blocking the first paint?The Render-blocking requests insight, and the Network panel
How much CSS is unused?The Reduce unused CSS diagnostic, and the Coverage tool
Is it minified and compressed?Minify CSS, and the content-encoding header
Are there chains?The Network dependency tree insight
How costly are style updates?In the Performance panel, the Recalculate Style events and the number of elements they affect

Check your own page

Run the free audit. Look first at the render-blocking list and the unused CSS figure. If one stylesheet is large and mostly unused, remove or split it before you touch anything else. The unused code guide and the critical CSS guide take it from there.

Sources

Start here

Free website audit

Live Google data for any public page: mobile and desktop.

Mobile + desktop · Lighthouse lab test · Real-user Chrome data when Google has it

Rather have this done for you? Speed optimization · Book a call

Related guides

All guides →