Cache-Control Header Generator

Create the right Cache-Control header with presets for static files, HTML pages and private data.

Runs in your browser Free
Presets:
—

Correct caching, faster sites

The Cache-Control header decides how long and under what conditions browsers and CDNs may store a response. Correct caching speeds up pages and reduces server load; wrong caching can show users stale content or store private data in shared caches.

Presets

  • Versioned static files: long-lived and immutable
  • HTML pages: revalidate on every request
  • Private or sensitive content: private or no-store

Explained and ready to apply

Every directive (max-age, s-maxage, no-cache, no-store, private, public, immutable, stale-while-revalidate) is explained in plain words. The resulting header is shown with ready snippets for Nginx, Apache and ASP.NET Core.

How to use Cache-Control Header Generator

  1. Choose the preset for your content type.
  2. Edit individual directives if needed.
  3. Read the explanations to confirm the behaviour.
  4. Copy the snippet for your server.

Why use this tool?

Prevents performance and privacy problems caused by caching mistakes and makes PageSpeed's 'efficient cache policy' advice easy to follow.

FAQ

What's the difference between no-cache and no-store?

no-cache allows storing but requires revalidation before each use; no-store forbids storing the response at all.

When should I use immutable?

For static files whose names contain a version or hash and whose content never changes.

Can I set a separate time for the CDN?

Yes, the s-maxage directive sets a separate lifetime for shared caches such as CDNs.

Related tools