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.
Typical setup
- Files with a version or hash in their URL, such as
main.v123.css, can be cached for a long time, for examplemax-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.
| Header / status | Request counterpart | What it does | Relevance 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 |
ETag | If-None-Match | identifier for the current version of a resource | supported and recommended by Google because it has no date formatting issues; takes precedence when both validators are present |
Last-Modified | If-Modified-Since | date and time at which the server believes the resource was last modified | supported; the date must follow the HTTP format, e.g. Fri, 4 Sep 1998 19:15:56 GMT |
304 Not Modified | response to a conditional GET or HEAD request | signals that the stored copy is still valid; the response has no body | the 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
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
- HTTP caching – MDN Web Docsdeveloper.mozilla.org
- HTTP Caching, RFC 9111rfc-editor.org
- Overview of Google crawlers and fetchers (HTTP caching) – Google Search Centraldevelopers.google.com
- Browser caching and site speed – DebugBeardebugbear.com
Last updated: