Skip to content

Menu

Cache-Control Builder

Build Cache-Control and CDN-Cache-Control headers from presets, or paste a header to get each directive explained and checked against RFC 9111.

Runs entirely in your browserNetworkFree, no sign-up
Loading tool
The public API presetWith public, max-age=0, s-maxage=60, stale-while-revalidate=30, stale-if-error=86400, browsers treat the response as stale at once while the CDN keeps it.Response with the headerBrowsermax-age=0: stale atonceCDNs-maxage=60 overridesmax-ageNext 30 sCDN may serve stale while it revalidatesOrigin errorstale copy for up to a day
With public, max-age=0, s-maxage=60, stale-while-revalidate=30, stale-if-error=86400, browsers treat the response as stale at once while the CDN keeps it.

01What is Cache-Control Builder?

A wrong Cache-Control header can keep users on an old page for days, or make a CDN fetch every request from your origin. Cache-Control Builder helps you write the header on purpose, and reads existing headers back to you directive by directive. It has two tabs. Build starts from four presets: a fingerprinted static asset, an HTML page, a public API cached at the CDN, and a private user-specific response. You can then change who may store the response (public, private or not stated), set max-age, s-maxage, stale-while-revalidate and stale-if-error in seconds, and tick no-cache, no-store, must-revalidate, proxy-revalidate, immutable and no-transform. The header updates as you go, and every directive in it is explained underneath. An optional CDN-Cache-Control max-age adds the header from RFC 9213, which CDNs that support it use in place of Cache-Control. Browsers ignore it. The explanations follow the specs. RFC 9111 says s-maxage applies only to shared caches such as CDNs and proxies, where it overrides max-age. It also says no-cache still allows storage but forbids reuse without a successful revalidation, while no-store forbids storage. RFC 8246 says immutable tells clients not to revalidate a fresh response on reload. RFC 5861 defines stale-while-revalidate and stale-if-error, which let a cache serve a stale copy during background revalidation or after an origin error. For a worked example, pick the public API preset. The output is public, max-age=0, s-maxage=60, stale-while-revalidate=30, stale-if-error=86400. Browsers treat the response as stale at once, while the CDN keeps it for 60 seconds. It may serve a stale copy for 30 more seconds while refreshing, or for a day if the origin fails. Explain takes a pasted header, with or without the Cache-Control: prefix, and lists each directive with its meaning and the RFC that defines it. You choose response or request mode first. Directive names are matched case-insensitively, and commas inside quoted field lists such as no-cache="a, b" are handled. It flags values that are not whole seconds, quoted seconds (RFC 9111 asks senders to use the token form), arguments on directives that take none, duplicates, and request-only directives used in a response or the other way round. It also warns about combinations that make no sense, like public with private, or no-store with max-age. Anything outside these RFCs is shown as an unknown extension, which caches must ignore. The tool does not know how a particular CDN or browser applies these rules, and it does not fetch URLs. Everything runs in your browser.

Web and backend developers and anyone running a CDN who needs to get caching headers right. The tool runs entirely in your browser, so your data never leaves your device.

02How to use Cache-Control Builder

  1. Open the Build tab and pick the preset closest to your response
  2. Adjust visibility, lifetimes and flags until the header says what you want
  3. Read the per-directive explanation and any warnings under the output
  4. Copy the header into your server, framework or CDN config
  5. To check an existing header, open Explain, choose response or request, and paste it

03Worked examples

Input: Preset: Static asset (fingerprinted)
Result: public, max-age=31536000, immutable
Input: Preset: Public API (CDN cached)
Result: public, max-age=0, s-maxage=60, stale-while-revalidate=30, stale-if-error=86400
Input: Explain: public, private="Set-Cookie", max-age="60", MAX-AGE=10, s-maxage=abc, only-if-cached
Result: max-age="60": should use the token form; second max-age: Directive appears more than once; s-maxage=abc: Value must be a non-negative whole number of seconds; only-if-cached: request directive in a response; warning: public and private together are contradictory
Explain tab, response mode
Input: Explain: private, no-store
Result: private: shared caches must not store the response; no-store: no cache may store any part of the request or response; no warnings
Explain tab, response mode. A common header for account pages; meanings are trimmed to the first sentence.
Input: Explain: no-cache, must-revalidate
Result: no-cache: may be stored, but must not be reused without a successful revalidation with the origin; must-revalidate: once stale, must not be reused without revalidating, even when disconnected; no warnings
Explain tab, response mode. no-cache still allows storing, it only forces a check with the origin before reuse.

04Common use cases

  • Writing the Cache-Control value for fingerprinted JS and CSS files
  • Checking why a CDN keeps serving an old HTML page
  • Adding stale-if-error so a CDN can serve cached API responses during an origin outage
  • Reviewing headers copied from DevTools for contradictions like public with private
  • Setting a separate CDN lifetime with CDN-Cache-Control

05Tips

  • no-cache does not stop storage; it forces revalidation before reuse. Use no-store to prevent storage
  • immutable only helps while the response is fresh, so pair it with a long max-age on versioned URLs
  • s-maxage applies to shared caches only and overrides max-age there
  • RFC 9111 expects must-understand to be sent together with no-store

06Related concepts

Cache-Control, CDN-Cache-Control, s-maxage, stale-while-revalidate, immutable, HTTP caching.

Frequently Asked Questions

What is Cache-Control Builder?

Cache-Control Builder is a free, browser-based developer tool on AIDToolStack. Build Cache-Control and CDN-Cache-Control headers from presets, or paste a header to get each directive explained and checked against RFC 9111. It requires no installation or sign-up and works entirely in your browser.

Is Cache-Control Builder free to use?

Yes. No sign-up, no fees and no usage cap.

Does Cache-Control Builder store my data?

No. It runs in your browser; nothing is uploaded.

Cheat sheet

Related Tools

Reviews and commentsShow

Reviews

Sign in to leave a review.

Loading reviews…

Comments

Sign in to leave a comment.

Loading comments…

What changed in AI dev tools, once a month

Renames, shutdowns, pricing changes and new MCP setups, each with a source.

Subscribe