Security · HTTP headers

Cache-Control analyzer.

Paste a Cache-Control header, optionally with Age, Date, Expires, ETag and Vary, and get each directive explained, conflicts flagged, and the freshness lifetime worked out for shared caches (CDNs) and for browsers. Everything runs in your browser; this page never fetches a URL, so nothing you paste is sent anywhere.

Sources: RFC 9111, RFC 5861, RFC 8246 Checks the header as written; it does not test what a real CDN does

Advertisement

Headers

With or without the "Cache-Control:" prefix. Several lines are combined.

Breakdown

Paste a Cache-Control header and press Analyze.

How caches read Cache-Control

Freshness lifetime. RFC 9111 section 4.2.1 takes the first rule that matches: (1) for a shared cache, s-maxage; (2) max-age; (3) Expires minus Date; (4) otherwise there is no explicit expiry and a cache may apply a heuristic (section 4.2.2, which suggests a fraction such as 10% of the time since Last-Modified). A response is fresh while freshness_lifetime > current_age. This tool uses the Age you enter as the current age, so the remaining time is a best case: the real current age also includes time spent since the response arrived.

no-cache is not no-store. no-cache lets a cache keep the response but requires successful revalidation with the origin before each reuse. no-store forbids storing it at all, in any cache. private keeps it out of shared caches but lets a browser store it. Neither no-store nor private is a reliable privacy control (section 5.2.2.5, 5.2.2.7).

Extensions. stale-while-revalidate and stale-if-error (RFC 5861) allow a stale response to be served for a further number of seconds, while revalidating or when the origin errors. immutable (RFC 8246) says the content will not change during its freshness lifetime, so clients should not revalidate on reload.

Conflicts. When directives conflict, for example max-age with no-cache, the most restrictive is honored (section 4.2.1). Invalid freshness values, such as max-age=abc, should be treated as stale. Expires is ignored when max-age is present, and by shared caches when s-maxage is present (section 5.3); an invalid Expires date such as 0 means already expired. Delta-seconds above 2,147,483,648 are capped at that value (section 1.2.2).

Sources: RFC 9111: HTTP Caching; RFC 5861: HTTP Cache-Control Extensions for Stale Content; RFC 8246: HTTP Immutable Responses; see also MDN: Cache-Control for browser notes.

Worked example: s-maxage overrides max-age for a CDN

Paste public, max-age=3600, s-maxage=86400, stale-while-revalidate=60 with an Age of 600 seconds. A shared cache (a CDN) and a browser read the same header differently.

CacheRule usedFreshness lifetimeRemaining after Age 600
Shared cache (CDN)s-maxage86400 s (1 day)85,800 s, about 23 hours 50 minutes; successful validation is required once stale because s-maxage implies proxy-revalidate
Browsermax-age3600 s (1 hour)3,000 s, about 50 minutes, then up to 1 minute of stale-while-revalidate

A conflicting header is flagged too: no-store, max-age=300 reports that no-store forbids storing, so max-age has no effect on a compliant cache.

Next steps: Set-Cookie inspector, security headers analyzer, or CSP generator.

What this analysis does and doesn’t tell you

This tool applies the written standard to the header text you paste. Real browsers, CDNs and proxies may add their own rules, ignore some directives, override lifetimes, or key their caches differently, so test against your actual stack. Nothing is fetched, stored or transmitted: the analysis runs entirely in your browser.

Common mix-ups

  1. RFC 9111: HTTP Caching (sections 5.2.2.4, 5.2.2.5, 5.2.2.10)

Checked against these sources on .

Frequently asked questions

Which wins, s-maxage or max-age?

For a shared cache such as a CDN, s-maxage wins. Browsers ignore s-maxage and use max-age.

What does no-store do?

It tells caches not to store the response at all. Freshness directives such as max-age then have no effect.

How is freshness worked out when there is no max-age?

RFC 9111 falls back to Expires minus Date, and then allows a heuristic lifetime, commonly around 10% of the time since Last-Modified.

Does this fetch my site?

No. It reads only the header text you paste, so nothing is requested or sent.

Advertisement
Advertisement