DevKits

Caching · Response header

ETag

A version identifier for the resource — the backbone of conditional GETs.

What is ETag?

ETag is an opaque string uniquely identifying a specific version of a resource. Clients send it back in If-None-Match on later requests; if unchanged, the server returns 304 Not Modified with no body — a huge bandwidth win.

Typical usage

Set on cacheable responses. Most frameworks generate ETags automatically.

Examples

Strong ETag (byte-identical)

ETag: "33a64df551425fcc55e4d42a148795d9f25f89d4"

Weak ETag (semantically equivalent)

ETag: W/"0815"

Common gotchas

Behind a load balancer, different instances must generate the same ETag for the same content, or caches will thrash. Base ETag on content hash, not memory address.

Also known as

Also commonly written as: etag header · http etag · etag vs last-modified · strong etag · weak etag · ETag ヘッダ. These variants — including plural forms, unhyphenated spellings, and Japanese (ヘッダ) — all refer to the same ETag HTTP header.

Specification

RFC 9110 §8.8.3

Frequently asked questions

What is the ETag HTTP header?

ETag is an opaque string uniquely identifying a specific version of a resource. Clients send it back in If-None-Match on later requests; if unchanged, the server returns 304 Not Modified with no body — a huge bandwidth win.

Is ETag a request or response header?

ETag is a response header — the server sends it to the client. Set on cacheable responses. Most frameworks generate ETags automatically.

What does a ETag header look like?

A typical ETag header looks like: ETag: "33a64df551425fcc55e4d42a148795d9f25f89d4" (Strong ETag (byte-identical)).

What are common mistakes with ETag?

Behind a load balancer, different instances must generate the same ETag for the same content, or caches will thrash. Base ETag on content hash, not memory address.

Related headers

Work with this header

Read the HTTP Caching Guide →