Graph
ETag

🏷️ETag

NEW

Also known as: Entity Tag

An HTTP response header carrying a version identifier for cache validation and conditional requests.

DESCRIPTION

ETag (Entity Tag) identifies a specific version of a resource, enabling clients to validate caches and perform conditional GETs or updates. With If-None-Match, servers return 304 Not Modified if the tag matches, saving bandwidth. With If-Match, ETags provide optimistic concurrency control by preventing lost updates. Strong and weak ETags balance strict byte equality versus semantic equivalence.

ALTERNATIVE DEFINITIONS

MDN Web Docs

The ETag HTTP response header is an identifier for a specific version of a resource.

Concise definition centered on version identification for HTTP resources.

Source

IETF RFC 7232

The ETag header field in a response provides the current entity-tag for the selected representation.

Normative definition specifying semantics in HTTP conditional requests.

Source

HTTP Caching Conditional Requests If-None-Match If-Match Cache-Control Optimistic Concurrency Control

COMPETING TERMS

Last-Modified

KNOWLEDGE AREAS

Data Integration & Interoperability Software Engineering Data Security

TARGET AUDIENCE

Software Developer DevOps Engineer Security Architect Solution Architect

EXTERNAL SOURCES

TOP QUESTIONS

How do ETags improve caching?

Clients send If-None-Match with the ETag to validate caches. If unchanged, servers return 304, reducing bandwidth and latency.

Category: Benefits

What’s the difference between strong and weak ETags?

Strong ETags require byte-for-byte equivalence; weak ETags allow semantically equivalent resources with the W/ prefix.

Category: Concepts

How do ETags support optimistic concurrency?

Clients include If-Match with the last seen ETag. The server updates only if tags match, preventing overwrites of newer versions.

Category: Usage

Are ETags globally unique?

No. ETags only need to be unique per resource representation within a server’s context.

Category: Misunderstanding

Can ETags leak sensitive information?

Poorly designed ETags that encode identifiable data could leak. Use opaque tags or hashes without sensitive content.

Category: Security

Do CDNs work with ETags?

Yes, but ensure consistent ETag generation across origins or normalize to avoid cache fragmentation.

Category: Integration

When should I prefer Last-Modified over ETag?

Use Last-Modified for simplicity when timestamp precision suffices; ETags give stronger guarantees and handle sub-second or semantic changes.

Category: Decision

Should ETags change on whitespace-only edits?

For strong ETags, yes; for weak ETags, not necessarily. Choose based on desired cache behavior.

Category: Opinion

How do I generate ETags efficiently?

Use content hashes or version numbers. Avoid expensive recomputation by caching ETag metadata alongside content.

Category: Performance