Cache-Control Header Builder

Compose a Cache-Control HTTP header value from the directives that matter most to browsers and CDNs — toggle a checkbox, type a number, paste an existing header and the page splits it back into its parts. Twelve common presets (Disable cache, Long cache immutable, Stale-while-revalidate, …) one click away, with a per-directive explainer and a one-paragraph rationale that updates as you toggle. Pure client-side — the response header you build never leaves your browser.

Presets

One click to drop a sensible combination into the editor below. Toggle directives after to customise it.

Directives

Toggle the directives that should appear in the rendered header. max-age, s-maxage, and the stale-helper fields take seconds.

Header value

Why this combination

Toggle a directive to see the rationale.

Per-directive explanation

Parse existing Cache-Control

Paste a header value to load it into the editor. The parser lowercases names, tolerates whitespace, reports unknown directives as warnings, and renders the result in canonical order.

How it works

The header value is rendered in a canonical order — max-age / s-maxage first (freshness), then public / private (scope), then the no-cache family, then the stale-helpers (stale-while-revalidate, stale-if-error), then any request-only fields at the end. The order in the input box is irrelevant — the builder picks its own.

no-store subsumes every other directive. When no-store is set, the builder still emits the warning rows below the rationale so you can see which directives became inert, but the rendered header carries only no-store (or its combination with private, which the RFC allows for clarity).

public and private are mutually exclusive. When both are set in the editor, the builder keeps public (the optimistic interpretation — private is more restrictive, but if you typed both you probably meant public, with the private flag being vestigial). An error finding is raised either way.

Semantics follow RFC 9111 (HTTP Caching), which obsoletes RFC 7234. The directive catalogue covers the standard set plus the three extensions we see most often in the wild (immutable, no-transform, must-understand) and the three request-only directives (max-stale, min-fresh, only-if-cached) that browsers forward when you set them on a fetch() call’s cache option.

Browsers and CDNs treat Cache-Control as a hint, not a contract. Private windows, Incognito mode, browser-configured "disable cache" dev tools, and corporate proxies can all override what you set. Treat the header as the upper bound of how cached things get, not the lower bound.