Deutsch
Servers, HTTP & caching

Browser caching

Also known as: HTTP caching, browser cache

Browser caching (also called HTTP caching) means that a browser stores a copy of a response, such as an image, stylesheet or script, and reuses it for later requests instead of loading it from the server again. HTTP caching is defined in RFC 9111. Which responses are stored and for how long is controlled by HTTP headers, mainly Cache-Control.

How does browser caching work?

A stored response is either fresh or stale. While it is fresh, the browser reuses it without contacting the server. The freshness lifetime comes from Cache-Control: max-age=<seconds>. When a stored response is stale, the browser can validate it: it sends the saved ETag in If-None-Match or the saved date in If-Modified-Since. If nothing changed, the server answers 304 Not Modified without a body.

If a response has no explicit freshness information, caches may still store it and estimate a lifetime, which is called heuristic caching. MDN recommends setting Cache-Control explicitly to avoid this.

Caches come in two kinds. A private cache belongs to one user, like the browser cache. A shared cache sits between many users and the server, for example in a CDN or reverse proxy.

CDN: edge server in front of the origin serverUsers and Googlebot request pages from the nearest edge server of the CDN. It holds the WAF and bot rules, edge functions that can change the response, and the cache. If a copy is cached, the edge server responds directly. If not, it fetches the page from the origin server. If the WAF blocks a crawler, Google recommends status code 503 or 429.UserGooglebotEdge server at the nearest locationWAF and bot ruleslet requests through or blockEdge functionschange the response (edge SEO)Cacheis a copy of the page stored?blockOrigin server(origin)cache missCache hit · the edge server responds directly, the origin is not asked.Cache miss · the edge server fetches the page from the origin and stores it.First request · the cache is still empty, the origin serves every URL at least once.Block · if the WAF blocks a crawler, Google recommends 503 or 429.
Google allows higher crawl rates for sites backed by a CDN. On the first request for a URL the cache is still empty, so the origin server delivers it. The order inside the edge server is simplified and differs between providers. Sources: Google Search Central Blog: Crawling December – CDNs and crawling (Dec 24, 2024); MDN: CDN (glossary); Cloudflare: Workers HTMLRewriter (example of edge functions).

Typical setup

  • Files with a version or hash in their URL, such as main.v123.css, can be cached for a long time, for example max-age=31536000, immutable, because a new version gets a new URL.
  • HTML pages cannot change their URL on each update. MDN suggests Cache-Control: no-cache, which stores the page but revalidates before each reuse.

Browser caching and crawlers

Google’s crawling infrastructure supports ETag with If-None-Match and Last-Modified with If-Modified-Since. Google’s documentation notes that individual crawlers may implement caching differently. A cache setting changes what the server must send again, not what a page contains.

Cache headers and 304 compared
Header / statusRequest counterpartWhat it doesRelevance for Google's crawlers
Cache-Control– (directives can also appear in requests)lists directives for caches, e.g. max-age (fresh for N seconds), no-cache (reuse only after revalidation), no-store (do not store)max-age is optional and helps crawlers decide when to recrawl the URL; Google does not support other caching directives
ETagIf-None-Matchidentifier for the current version of a resourcesupported and recommended by Google because it has no date formatting issues; takes precedence when both validators are present
Last-ModifiedIf-Modified-Sincedate and time at which the server believes the resource was last modifiedsupported; the date must follow the HTTP format, e.g. Fri, 4 Sep 1998 19:15:56 GMT
304 Not Modifiedresponse to a conditional GET or HEAD requestsignals that the stored copy is still valid; the response has no bodythe crawler tells the next system that the content is the same as at the last crawl; Search may recalculate signals, otherwise no effect on indexing

Google suggests setting both ETag and Last-Modified, since other applications use them too. Whether a Google crawler uses caching depends on its product: Googlebot uses it when recrawling URLs for Google Search. According to Google's December 2024 blog post, only 0.017% of all fetches could be served from cache. Sources: Google Crawling Infrastructure: Overview of Google crawlers and fetchers, HTTP caching (last updated 2026-06-12); Google Search Central Blog: Crawling December: HTTP caching (2024-12-09); Google Crawling Infrastructure: HTTP status codes, network and DNS errors (last updated 2026-02-04); MDN: HTTP caching; RFC 9111: HTTP Caching; RFC 9110: HTTP Semantics (8.8.2 Last-Modified, 8.8.3 ETag, 15.4.5 304). Last checked: .

Example

HTTP
Cache-Control: public, max-age=31536000, immutable
ETag: "YsAIAAAA-QG4G6kCMAMBAAAAAAAoK"

Common questions

Is it okay to clear the browser cache? Yes. The browser downloads the files again on the next visit.

Sources

  1. HTTP caching – MDN Web Docsdeveloper.mozilla.org
  2. HTTP Caching, RFC 9111rfc-editor.org
  3. Overview of Google crawlers and fetchers (HTTP caching) – Google Search Centraldevelopers.google.com
  4. Browser caching and site speed – DebugBeardebugbear.com

Last updated: