HomeAPI StatusFree ToolsSEO Help Articles

CSS Caching Test

The CSS Caching Test inspects the Cache-Control headers on every .css file referenced by a URL and reports whether each is being cached aggressively, briefly or not at all. Versioned stylesheets (with a hash in the filename) can be cached for a year with the immutable directive — making repeat visits effectively free. Unhashed stylesheets need shorter lifetimes to allow updates.

What This Tool Checks

  • Cache-Control header per .css file
  • max-age and immutable directives
  • Versioned stylesheet detection
  • Inline critical CSS vs external CSS
  • CDN cache hit ratio for CSS
  • ETag headers for revalidation

Why It Matters for SEO

CSS bundles are usually small but on the critical render path — a slow CSS request blocks first paint. Caching them aggressively turns repeat visits into immediate paints. Most modern build pipelines output content-hashed CSS, making 1 year + immutable trivially safe. The only risk is third-party stylesheets (Google Fonts, framework defaults) that you do not control.

How to Fix It

For hashed CSS bundles: Cache-Control: public, max-age=31536000, immutable. For unhashed CSS: shorter max-age with revalidation. Self-host fonts and framework CSS where possible to control cache lifetime. Inline only the truly critical above-the-fold CSS; cache the rest aggressively.

How It Works

We walk every <link rel="stylesheet"> on the page, request each with HEAD, capture cache headers, and detect content-hashing in URLs. Recommendations are tailored per asset based on whether the URL is safely versioned.

Common Mistakes to Avoid

  • Hashed CSS cached for only an hour
  • Missing immutable on hashed CSS URLs
  • External Google Fonts CSS adding cross-origin requests on every visit
  • Cache-Control: no-cache on critical CSS
  • Inlining all CSS instead of caching the external bundle

Quick Checklist

  • Hashed CSS cached 1 year with immutable
  • Critical above-the-fold CSS inlined
  • External fonts self-hosted where possible
  • No Cache-Control: no-cache on production CSS
  • CDN responds HIT on repeat CSS requests

Frequently Asked Questions