Deutsch
Servers, HTTP & caching

Last-Modified header

Also known as: If-Modified-Since

The Last-Modified header is an HTTP response header with the date and time the server believes a resource was last changed. The client can send that date back in an If-Modified-Since request header to ask whether anything changed.

At a glance

Type
HTTP response header
Affects
conditional requests with If-Modified-Since
Values
date in HTTP format, GMT

Last checked:

How do Last-Modified and If-Modified-Since work together?

The server sends Last-Modified in GMT, for example Wed, 21 Oct 2015 07:28:00 GMT. On the next request, the client adds If-Modified-Since with this value. If the resource has not changed, the server answers 304 Not Modified without a body. If it changed, the server sends 200 with the full content. This works for GET and HEAD requests only. When If-None-Match is present, it takes precedence.

MDN calls Last-Modified less precise than ETag, and RFC 9110 notes a granularity of one second. Google’s crawling infrastructure supports both validators, and Google recommends ETag, in part to avoid date formatting problems.

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-Modified (this term)If-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
HTTP/1.1 200 OK
Last-Modified: Wed, 21 Oct 2015 07:28:00 GMT

GET /page/ HTTP/1.1
If-Modified-Since: Wed, 21 Oct 2015 07:28:00 GMT

Common mistakes

The header shows the current time on every request. The client then never gets a 304.

Sources

  1. Last-Modified header – MDNdeveloper.mozilla.org
  2. If-Modified-Since header – MDNdeveloper.mozilla.org
  3. HTTP caching of Google's crawlers – Google Search Centraldevelopers.google.com
  4. RFC 9110, Section 8.8.2 Last-Modifiedrfc-editor.org

Last updated: