ETag

The HTTP ETag header contains an "entity tag" that is used to identify a particular version of a resource for Caching purposes.

Usage

The entity tag ETag header is an identifier that is intended to uniquely identify a specific version of a resource. For example, more recent versions of documents at the same URL will be given new ETag values.

The ETag is used to tell if newer or different versions of the same resource are available. This allows clients to conserve bandwidth with client-side Caching by not re-downloading versions of the resource that they already have.

Weak ETags versus strong ETags

A weak ETag is easier to generate than a strong ETag, albeit not as useful for comparing two entities. They guarantee only that two different entities are not equivalent using a byte-level comparison. Two copies of the same resource, however, can be still semantically identical.

A weak ETag is defined using:

ETag: W/"<ETag-value>"

A strong ETag lacks the optional W/ prefix, as follows:

ETag: "<ETag-value>"

Takeaway

The ETag header contains an identifier used to differentiate between different resources and different versions of the same resource. It is part of the conditional request architecture.

See also

Last updated: June 2, 2022