# HTTP caching

> HTTP caching lets browsers, proxies, and CDNs store and reuse responses. Learn freshness, validation with ETag, and which headers to set.

Canonical: https://scaplet.com/glossary/http-caching

Glossary Glossary · Performance

HTTP caching lets browsers, proxies, and CDNs store and reuse responses. Learn freshness, validation with ETag, and which headers to set.

5 min

read

5

sources

Oct 21, 2026

updated

Scaplet Editorial Team

author

In one line

HTTP caching is the standard way browsers, proxies, and CDNs store a response and reuse it for later requests instead of fetching it again. A stored response is either fresh, so it is reused as is, or stale, so the cache must validate it with the origin first. Headers such as Cache-Control, ETag, and Last-Modified control both steps.

30-second check

## Is this costing your site traffic?

Four quick questions, then a straight answer.

1/4Have you checked your own site for this?

Summarize this page with [ChatGPT](https://chatgpt.com/?hints=search&q=Summarize%20https%3A%2F%2Fscaplet.com%2Fglossary%2Fhttp-caching%20(%22HTTP%20caching%22)%20in%205%20bullet%20points%2C%20then%20tell%20me%20the%20one%20thing%20I%20should%20do%20next.) [Claude](https://claude.ai/new?q=Summarize%20https%3A%2F%2Fscaplet.com%2Fglossary%2Fhttp-caching%20(%22HTTP%20caching%22)%20in%205%20bullet%20points%2C%20then%20tell%20me%20the%20one%20thing%20I%20should%20do%20next.) [Perplexity](https://www.perplexity.ai/search?q=Summarize%20https%3A%2F%2Fscaplet.com%2Fglossary%2Fhttp-caching%20(%22HTTP%20caching%22)%20in%205%20bullet%20points%2C%20then%20tell%20me%20the%20one%20thing%20I%20should%20do%20next.) [![Google](/logos/ai/google-color.svg)AI Mode](https://www.google.com/search?udm=50&q=Summarize%20https%3A%2F%2Fscaplet.com%2Fglossary%2Fhttp-caching%20(%22HTTP%20caching%22)%20in%205%20bullet%20points%2C%20then%20tell%20me%20the%20one%20thing%20I%20should%20do%20next.)

On this page

## 6 parts, 5 minutes.

1. [How HTTP caching works 01](#how-http-caching-works)
2. [Private caches, shared caches, and CDNs 02](#private-caches-shared-caches-and-cdns)
3. [The headers that matter 03](#the-headers-that-matter)
4. [Tips most guides miss 04](#tips-most-guides-miss)
5. [What Googlebot supports 05](#what-googlebot-supports)
6. [Check it in two minutes 06](#check-it-in-two-minutes)

_01_Worth knowing

## How HTTP caching works

When a client asks for a URL, a cache between it and the origin server can answer from a stored copy. The standard that defines this is RFC 9111, which "defines HTTP caches and the associated header fields that control cache behavior or indicate cacheable response messages." The saved copy is in one of two states, based on age. Age is the time since the response was generated.

### Fresh

the age is below the lifetime you set, so the cache serves it without contacting the origin.

### Stale

the lifetime has passed. The cache does not throw the copy away. It asks the origin whether the copy is still good, which is called validation.

### Validated

if the origin answers 304 Not Modified, the stored copy becomes fresh again and no body is sent.

Per MDN, a validation request is conditional: it carries `If-None-Match` (from the `ETag`) or `If-Modified-Since` (from `Last-Modified`). If both are present, `If-None-Match` takes precedence.

_02_At a glance

## Private caches, shared caches, and CDNs

MDN splits caches into two kinds. A private cache belongs to one client, typically a browser, so it can hold personalized responses. A shared cache sits between clients and the server and can serve many users. Managed caches, such as reverse proxies, CDNs, and service workers with the Cache API, are shared caches you deploy yourself.

Cache

### Browser (private)

Who it serves

One user

What to set

`Cache-Control: private` is fine for personalized pages

Cache

### CDN or reverse proxy (managed, shared)

Who it serves

Everyone

What to set

Keep personalized responses out with `private` or `no-store`; many CDNs add their own controls

Cache

### Proxy cache on the network path

Who it serves

Group of users

What to set

Mostly invisible over [HTTPS](/glossary/https); you do not control it

The same MDN guide notes that some CDNs use headers that only they honor, such as `Surrogate-Control`, and says work was underway on a `CDN-Cache-Control` header to standardize them. That header is now defined in RFC 9213 (Targeted [HTTP Cache Control](/glossary/cache-control)). Read your CDN's docs before assuming it follows the browser rules. For edge behavior see [edge caching](/glossary/edge-caching) and [CDN](/glossary/cdn).

_03_At a glance

## The headers that matter

Header

### `Cache-Control: max-age=N`

Job

Sets freshness in seconds

Notes from the docs

MDN: `max-age` wins over `Expires` when both are present

Header

### `ETag`

Job

Validator: a server-chosen value for this version

Notes from the docs

Any value works, such as a content hash

Header

### `Last-Modified`

Job

Validator: a timestamp

Notes from the docs

MDN says to send both `ETag` and `Last-Modified` when possible

Header

### `Vary`

Job

Lists request headers that change the response

Notes from the docs

`Vary: Accept-Language` caches each language separately

Header

### `no-cache`

Job

Forces validation before every reuse

Notes from the docs

It does not stop the response from being stored

Header

### `no-store`

Job

Do not store the response

Notes from the docs

MDN warns it also gives up the browser [back/forward cache](/glossary/bfcache)

Details of each directive are on the [Cache-Control](/glossary/cache-control) page.

_04_Worth knowing

## Tips most guides miss

### Heuristic caching is real

MDN says that without `Cache-Control`, a response with a `Last-Modified` date can still be stored and reused, and the spec suggests about 10% of the time since the last change. MDN's advice is to give all responses an explicit `Cache-Control` header.

### Don't use `User-Agent` in `Vary`

MDN notes it has so many variations that it drastically reduces cache reuse.

### Cookies are not a privacy switch

MDN says a cookie alone does not make a response private. Use `Cache-Control: private` for personalized content.

### You can't recall a long-lived response

MDN states there is no way to delete responses stored on intermediate servers with a long `max-age`. Change the URL (a version or hash in the filename) when the file changes, as web.dev advises.

### `immutable` is for fingerprinted files

MDN's example is `Cache-Control: max-age=31536000, immutable`, which skips revalidation on reload for content that never changes.

_05_Explained

## What Googlebot supports

[Google's crawler](/ai-crawlers/googlebot) documentation says its crawling infrastructure "supports heuristic HTTP caching as defined by the HTTP caching standard," specifically `ETag` with `If-None-Match`, and `Last-Modified` with `If-Modified-Since`. If both validators are present, Google's crawlers use the `ETag` value. Google adds "Other HTTP caching directives aren't supported."

It also says to consider setting `max-age` to help crawlers decide when to recrawl, set to the number of seconds the content is expected to stay unchanged. And individual Google crawlers may or may not use caching: Googlebot supports caching when re-crawling URLs for Search. Google also recommends setting both `ETag` and `Last-Modified`, since other applications such as CMSes use them too.

_06_Check it

## Check it in two minutes

Run it twice. A shared cache that served the copy usually adds an `Age` header. The Network panel in your browser DevTools shows the status of each request, and a validated response comes back as 304. Repeat for an HTML page and a hashed asset: the page should revalidate or have a short lifetime, the asset a long one.

Look at the headers of any URL

```
curl -sI https://example.com/styles.css | grep -i -E 'cache-control|etag|last-modified|vary|age'
```

Questions

## Asked a lot.

5 questions people ask next, answered from the sources on this page.

_01_ What is the HTTP cache?

It is the set of browser and intermediary caches that store HTTP responses and reuse them for later requests. web.dev calls the browser's HTTP Cache your first line of defense against unnecessary network requests, and notes it is a collection of web platform APIs rather than a single API.

_02_ What is the difference between no-cache and no-store?

Per MDN, no-cache lets a response be stored but requires validation with the origin before each reuse. no-store tells caches not to store the response at all.

_03_ How do I cache a website?

Set an explicit Cache-Control header on every response. Give fingerprinted static files a long max-age, and give HTML a short lifetime or no-cache with an [ETag](/glossary/etag) so it revalidates. Send private on personalized pages.

_04_ Does Google use HTTP caching when it crawls?

Yes, for some crawlers. Google documents support for ETag with If-None-Match and Last-Modified with If-Modified-Since, and says Googlebot supports caching when re-crawling URLs for Search.

_05_ How long should I cache a page?

It depends on how often the content changes. The docs fix the mechanics: max-age is seconds of freshness, and a response stored with a long max-age can't be deleted from intermediate caches, so change the URL when the file changes. Web.dev suggests max-age=31536000 for versioned resources and no-cache for resources that should be revalidated before every use.

Sources · 5

## Every fact, linked and dated.

Official docs first. The date is when we last opened each page.

- mozilla.org
- rfc-editor.org
- web.dev
- google.com

1. 01 [HTTP caching - MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web/HTTP/Guides/Caching) developer.mozilla.org · checked 2026-10-25
2. 02 [RFC 9111: HTTP Caching](https://www.rfc-editor.org/rfc/rfc9111) rfc-editor.org · checked 2026-10-25
3. 03 [Prevent unnecessary network requests with the HTTP Cache - web.dev](https://web.dev/articles/http-cache) web.dev · checked 2026-10-25
4. 04 [RFC 9213: Targeted HTTP Cache Control](https://www.rfc-editor.org/rfc/rfc9213) rfc-editor.org · checked 2026-10-25
5. 05 [Google crawlers and fetchers overview (HTTP caching)](https://developers.google.com/search/docs/crawling-indexing/overview-google-crawlers) developers.google.com · checked 2026-10-25

## Keep learning

[All glossary](/glossary)

[Learn Cache-Control Performance](/glossary/cache-control) [Related Page speed Performance](/glossary/page-speed) [Read next Edge caching Performance](/glossary/edge-caching) [Do Run a free site audit Free, about two minutes](/site-audit)

Nearby in glossary
[HTTP status codes](/glossary/http-status-codes) [HTTPS](/glossary/https)

More in Performance
[Core Web Vitals report](/glossary/core-web-vitals-report) [CORS](/glossary/cors) [Critical CSS](/glossary/critical-css) [Critical rendering path](/glossary/critical-rendering-path) [Cumulative Layout Shift (CLS)](/glossary/cumulative-layout-shift) [dns-prefetch](/glossary/dns-prefetch) [Edge caching](/glossary/edge-caching) [fetchpriority](/glossary/fetchpriority) [First Contentful Paint](/glossary/first-contentful-paint) [First Input Delay (FID)](/glossary/first-input-delay) [font-display](/glossary/font-display) [Gzip compression](/glossary/gzip-compression) [HTTP caching](/glossary/http-caching) [HTTP/2](/glossary/http-2) [HTTP/3](/glossary/http-3) [Image compression](/glossary/image-compression) [Interaction to Next Paint (INP)](/glossary/interaction-to-next-paint) [Largest Contentful Paint](/glossary/largest-contentful-paint) [Lazy loading](/glossary/lazy-loading) [Lighthouse](/glossary/lighthouse) [Page experience](/glossary/page-experience) [Page speed](/glossary/page-speed) [PageSpeed Insights](/glossary/pagespeed-insights) [preconnect](/glossary/preconnect)

Terms on this page
[HTTPS](/glossary/https) [Edge caching](/glossary/edge-caching) [CDN](/glossary/cdn) [Cache-Control](/glossary/cache-control) [bfcache (back/forward cache)](/glossary/bfcache) [ETag](/glossary/etag)

Free · 2 minutes

## Know the term. _Now check your site._

The free audit reads robots.txt, sitemaps, status codes, canonicals, redirects and structured data.

[Audit my site free](/site-audit)

Free, no card 60 seconds Nobody will call you

- **46** fixes shipped without a ticket Brightpipe
- **+212%** organic clicks in 90 days Ledgerly
