HTTP Cache TTL / max-age Calculator
Guide
HTTP Cache TTL / max-age Calculator
Build HTTP Cache-Control headers visually. Select a caching strategy preset or configure individual directives — max-age, s-maxage, stale-while-revalidate, immutable, and more. Get a ready-to-use header string with human-readable explanations and CDN-specific equivalents.
How to Use
Choose a strategy preset (Static Assets, HTML Pages, API Responses, CDN Edge Cache) to auto-fill common configurations, or use Custom mode to build your header from scratch. Toggle directives, set time values for max-age and s-maxage, and the complete Cache-Control header string generates instantly. Copy it directly into your server configuration, .htaccess, or application code.
Features
- Strategy Presets – Pre-configured settings for common scenarios: static assets (1 year, immutable), HTML pages (revalidate every request), API responses (private, no-cache), and CDN edge caching.
- All Cache-Control Directives – Configure public, private, no-cache, no-store, max-age, s-maxage, stale-while-revalidate, stale-if-error, must-revalidate, proxy-revalidate, no-transform, and immutable.
- Conflict Detection – Warns when you select conflicting directives like no-store with max-age, or public with private simultaneously.
- Human-Readable Time Display – Automatically converts seconds to readable format (86400 seconds = 1 day) next to every time input.
- Header Explanation – Shows a plain-English explanation of what your configured header actually does.
- CDN-Specific Headers – Generates equivalent headers for Cloudflare (CDN-Cache-Control), Varnish/Fastly (Surrogate-Control).
- Real-Time Generation – Header string updates instantly as you toggle any directive or change any value.
When to Use This Tool
Use this tool when configuring caching for web applications, setting up CDN cache policies, optimizing static asset delivery, or debugging cache behavior. It’s essential for web developers, DevOps engineers, and anyone working with HTTP caching who needs to build correct Cache-Control headers without memorizing the RFC 7234 specification.
FAQ
-
What is the Cache-Control header?
Cache-Control is an HTTP header that tells browsers and CDNs how to cache a response. It controls whether a response can be cached (public vs private), how long it can be cached (max-age in seconds), whether it must be revalidated before use (no-cache, must-revalidate), and whether it should never be stored at all (no-store). Getting Cache-Control right is one of the most impactful web performance optimizations available.
-
What is the difference between max-age and s-maxage?
max-age sets the cache lifetime for all caches — both browser caches and shared (CDN/proxy) caches. s-maxage (shared max-age) overrides max-age specifically for shared caches like CDNs and proxy servers, while browsers still use max-age. This lets you set different cache durations: for example, max-age=60 (browser caches for 1 minute) with s-maxage=86400 (CDN caches for 1 day). This is a common pattern for content that changes occasionally.
-
What does stale-while-revalidate do?
stale-while-revalidate allows caches to serve a stale (expired) response while simultaneously fetching a fresh one in the background. For example, stale-while-revalidate=86400 means the cache can serve an expired response for up to 1 day while it revalidates asynchronously. This dramatically improves perceived performance because users never wait for revalidation — they get an instant (slightly stale) response while the cache updates itself for the next request.
-
What is the difference between no-cache and no-store?
no-cache does NOT mean 'don't cache.' It means 'cache the response, but always revalidate with the server before using it.' The browser stores the response but checks with the server (via ETag or Last-Modified) before serving it — if the content hasn't changed, the server responds with 304 Not Modified and the cached version is used. no-store means 'don't cache at all' — the response must never be stored by any cache. Use no-cache for content that might change but benefits from conditional requests; use no-store for sensitive data that should never be persisted.
Install Our Extensions
Add IO tools to your favorite browser for instant access and faster searching
恵 Scoreboard Has Arrived!
Scoreboard is a fun way to keep track of your games, all data is stored in your browser. More features are coming soon!
Must-Try Tools
View All New Arrivals
View AllUpdate: Our latest tool was added on Mar 28, 2026
