Last-Modified Header Explained

What the HTTP Last-Modified header does and when it's used.

Published October 14, 2026

Last-Modified tells the client when the resource was last changed. Clients use it for conditional requests and heuristic caching.

How it works

Servers derive it from file timestamps or database updated_at.

The Last-Modified header is part of the HTTP message and is case-insensitive in name.

In a real exchange

curl -i https://example.com/
Last-Modified: Wed, 21 Oct 2026 07:28:00 GMT
Where Last-Modified appears.

Practical examples

The header

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

Set or use it in code

res.set('Last-Modified', new Date(row.updated_at).toUTCString())

Inspect it

curl -sI https://example.com | grep -i 'last-modified'

Common mistakes

  • Using the current time on every response
  • Timezone mistakes (must be GMT)
  • Omitting Cache-Control and relying on heuristics

Key takeaways

  • Last-Modified: Last-Modified tells the client when the resource was last changed.
  • Check it in browser DevTools → Network.
  • Test with curl -I before deploying.

FAQ

Without Cache-Control?

Browsers may cache heuristically based on Last-Modified.

Is Last-Modified case sensitive?

Header names are case-insensitive; values may not be.

More HTTP articles