Калькулятор TTL / max-age HTTP-кэша

ДанныеРазработчик
РЕКЛАМА · УДАЛЯТЬ?

Cache Scope

Caching Behavior

Time-to-Live (TTL)

How long the browser can cache the response
How long shared/CDN caches can store the response
Serve stale while fetching fresh response in background
Serve stale response if origin returns an error

CDN-Specific Headers

РЕКЛАМА · УДАЛЯТЬ?

Гид

HTTP Cache TTL / max-age Calculator

Калькулятор TTL / max-age HTTP-кэша

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.

Как использовать

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.

Функции

  • 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).
  • Генерация в реальном времени – Header string updates instantly as you toggle any directive or change any value.

Когда использовать этот инструмент

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.

РЕКЛАМА · УДАЛЯТЬ?

Часто задаваемые вопросы

  1. 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.

  2. 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.

  3. 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.

  4. 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.

Хотите убрать рекламу? Откажитесь от рекламы сегодня

Установите наши расширения

Добавьте инструменты ввода-вывода в свой любимый браузер для мгновенного доступа и более быстрого поиска

в Расширение Chrome в Расширение края в Расширение Firefox в Расширение Opera

Табло результатов прибыло!

Табло результатов — это интересный способ следить за вашими играми, все данные хранятся в вашем браузере. Скоро появятся новые функции!

РЕКЛАМА · УДАЛЯТЬ?
РЕКЛАМА · УДАЛЯТЬ?
РЕКЛАМА · УДАЛЯТЬ?

новости с техническими моментами

Примите участие

Помогите нам продолжать предоставлять ценные бесплатные инструменты

Купи мне кофе
РЕКЛАМА · УДАЛЯТЬ?