Cache-Control max-age Explained
Convert the Cache-Control max-age value (in seconds) into a readable time in hours and days. Useful for understanding and debugging HTTP cache and CDNs.
Duração
—
How long 31536000 seconds actually is
You open DevTools, see Cache-Control: max-age=604800 and stall trying to divide it in your head. Or you copied the number from a tutorial and have no idea whether you are caching for five minutes or five days, which matters a lot the day a bad deploy goes out. Paste the seconds and the page gives you the equivalent in minutes, hours, days or years, switching units as the value grows.
max-age does not start counting when the file reaches your browser. It counts from the moment the response was generated, and the Age header tells you how much of that budget was already burned inside a proxy or CDN. A max-age=3600 response arriving with Age: 3500 is good for another hundred seconds. To treat browsers and CDNs differently there is s-maxage, which overrides max-age in shared caches. The conversion here assumes a 365-day year.
The field takes any number, but in the spec max-age is a non-negative integer. Fractional or negative values are treated by caches as invalid or already stale. A full year, 31536000, only makes sense for files with a versioned name such as app.4f2c1.js, otherwise users get stuck on an old build with no way out. For HTML the usual answer is no-cache plus an ETag. This page only translates the number, it does not build the header.
Frequently asked questions
How long is 31536000 seconds?
Are max-age=0 and no-store the same thing?
Does the tool generate the Cache-Control header for me?
Related Tools
HTTP Request Builder
Build an HTTP request (URL, method, headers, body) and generate snippets in cURL, fetch, axios, Python requests and Go net/http. Everything in your browser.
Basic Auth Generator
Generate the HTTP `Authorization: Basic <base64>` header from username and password. Useful to test APIs with basic auth via curl, Postman or fetch. Everything in your browser.
ETag Weak vs Strong
Classifica um ETag como weak (W/"...") ou strong. Weak é igualdade semântica, strong é byte-a-byte.