Cache TTL Helper
Convert cache TTL values between units and generate the correct Cache-Control header string.
TTL Input
Quick Presets
All Units
Cache-Control Header
Cache-Control: max-age=86400
Common Cache-Control Directives
| Directive | Description |
|---|---|
| max-age=N | Response is fresh for N seconds. Applies to browsers and CDNs. |
| s-maxage=N | Overrides max-age for shared caches (CDNs, proxies). Browsers use max-age. |
| no-cache | Cache may store the response but must revalidate with the server before each use. |
| no-store | Response must not be stored anywhere. Use for sensitive or real-time data. |
| stale-while-revalidate=N | Serve stale content for up to N seconds while fetching a fresh response in the background. |
| immutable | Tells the browser the response will never change. Skip revalidation on reload. Use with versioned URLs. |
| public | Any cache (browser, CDN, proxy) may store the response, even if normally private. |
| private | Only the end-user browser may cache the response. CDNs and proxies must not store it. |
Copied!
Summary
Convert cache TTL values between units and generate the correct Cache-Control header string.
How it works
- Enter a TTL number and pick a unit (seconds, minutes, hours, days, or weeks).
- The tool converts the value to all other time units.
- Copy the ready-to-use Cache-Control: max-age=<seconds> header value.
- Read the human-readable expiry breakdown (days, hours, minutes, seconds).
- Use the preset buttons to jump to common durations like 1 hour or 7 days.
Use cases
- Set an appropriate CDN or browser cache TTL for static assets.
- Quickly convert a TTL specification from days to seconds for a config file.
- Verify that a Cache-Control header matches the intended expiry duration.
- Reference common Cache-Control directives while writing server config.
Frequently Asked Questions
Last updated: 2026-07-01 ·
Reviewed by Nham Vu