BF50 Black Friday · 50% off all plans
from $5/mo · Auto-applied ---:--:-- Claim 50% off →
Skip to content

Search Seonio

Type a keyword, domain, or paste a URL

Start free with $1 to see full results. Powered by Seonio
Web Development

Last-Modified header: How it helps caching and SEO

Last-Modified is an HTTP response header with the date a file last changed. Browsers and crawlers send it back to ask whether they need a fresh copy.

Monthly searches · last-modified
1.9k
Keyword research data
last-modified
Last-Modified header: How it helps caching and SEO
Click the image to view it full size

Last-Modified is a header that a web server sends with a response to say when the file (an HTML page, image, PDF or anything else) last changed. It looks like this:

Last-Modified: Wed, 21 Oct 2015 07:28:00 GMT

The date is always in GMT, in that exact format. Its main job is to let browsers, caches and search engine crawlers check whether a copy they already have is still current, so the server doesn't have to send the whole file again.

How browsers and crawlers use it

The header works as a validator in what HTTP calls a conditional request:

  1. A browser or crawler requests /pricing. The server sends the page with Last-Modified: Wed, 21 Oct 2015 07:28:00 GMT.
  2. Next time, the client asks again and adds the date it has: If-Modified-Since: Wed, 21 Oct 2015 07:28:00 GMT.
  3. If the page hasn't changed since then, the server answers 304 Not Modified with no body, and the client uses its stored copy. If it has changed, the server sends the new page with a 200 status and a new date.

A 304 response is tiny, so this saves bandwidth and server work on every repeat visit.

If the client also sends If-None-Match (the ETag check), the server is supposed to use that and ignore If-Modified-Since.

Why it matters for SEO

Googlebot supports both validators when it re-crawls pages for Google Search. Google's crawl budget guide recommends supporting 304 responses: if a page hasn't changed since Google last crawled it, a 304 tells Google to reuse its cached version and saves your server's resources. On a large site with many unchanged pages, that frees capacity for the pages that did change (see crawl budget).

Three details from Google's crawler documentation Google Search Central:

  • If you send both ETag and Last-Modified, Google's crawlers use the ETag. Google recommends ETag for its crawlers because it has no date formatting problems, but suggests setting both, since other software uses Last-Modified.
  • The date must follow the HTTP format. Google gives Fri, 4 Sep 1998 19:15:56 GMT as an example.
  • Cache-Control: max-age can help. Setting it to the number of seconds you expect the content to stay unchanged helps crawlers decide when to come back.

Don't confuse the header with the <lastmod> date in an XML sitemap. That's a separate signal: Google uses it only if it's consistently and verifiably accurate, and it should change only for significant updates (main content, structured data, links), not a new copyright year.

Caching when there are no other instructions

If a response has no explicit freshness information, such as Cache-Control: max-age or Expires, browsers and caches may guess how long to keep it. HTTP's caching standard suggests basing that guess on Last-Modified, with 10% of the time since the last change as a typical setting RFC 9111. A file last changed 10 days ago might then be reused for about a day without checking.

That guess can leave visitors with a stale page after you update it. If freshness matters, set Cache-Control yourself instead of relying on the guess.

How to set it up correctly

  • Send the real modification time. The HTTP standard says servers should send Last-Modified whenever they can determine it reasonably and consistently. A date that changes on every request, or never changes, defeats the purpose.
  • Never send a future date. It must not be later than the response's own Date header.
  • Use GMT. HTTP dates are never in local time.
  • Send ETag as well, for Google and for changes that happen within the same second.
  • Check it. Run curl -I https://example.com/page and look for Last-Modified in the response. Then send the date back with curl -I -H "If-Modified-Since: <date>" and confirm you get a 304.

If your pages come from a CMS or framework, check that they send the header at all: dynamic pages may not unless you configure it.

Last-Modified vs ETag

Last-Modified ETag
What it holds A date and time An identifier for this version of the file
Precision One second; a weak validator Any change, if the server generates it per version
Request header it pairs with If-Modified-Since If-None-Match
Google's crawlers Supported Supported and preferred when both are sent
SEO wiki

Related terms

More definitions from the same corner of SEO and digital marketing.

Seonio

Put it to work on your own site

Keyword research, traffic, backlinks and clustering in one place. Start with a free $1 to test, no card required.