ETag

What Is an ETag?

An ETag, short for entity tag, is an HTTP response header that identifies a particular version of a resource’s representation. Browsers, caches, and applications can use it to check whether previously retrieved content still matches the server’s current version.

An ETag might appear as ETag: "asset-r17". Its value is an identifier to compare, rather than something clients should interpret. Servers can generate ETags using content hashes, revision numbers, or other methods.

For image and video delivery, ETags help avoid transferring unchanged content. They can also support conditional updates to resources managed through APIs.

How ETags Work

Validating Cached Content

When a browser receives a cacheable response containing an ETag, it can retain the identifier alongside the content.

Later, when validation is needed, the browser can send that value in an If-None-Match request header. If it matches the current representation, the server can return 304 Not Modified, without sending the content again. The browser then reuses its stored copy.

If the representation has changed, an otherwise successful request normally receives the current content and its updated ETag. Validation still involves a request, but can substantially reduce the data transferred.

Protecting Updates With If-Match

An application can also send an ETag through If-Match when updating a resource.

For example, an asset management application might retrieve an editable description and its ETag. When saving changes, it submits that identifier as a precondition. If another editor has changed the resource in the meantime, the server can reject the outdated update with 412 Precondition Failed.

This protection requires the API to evaluate the precondition before applying the change. If-Match uses strong comparison.

Strong vs. Weak ETags

ETags have two forms, distinguished by whether the value begins with W/.

Type Example Meaning
Strong ETag "asset-r17" Matching validators identify equivalent representation data at the byte level
Weak ETag W/"asset-r17" Matching validators allow semantic equivalence without requiring identical bytes

Weak validators can support cache validation, but are unsuitable for operations that require exact byte correspondence.

For conditional range requests, a client must not put a weak ETag in If-Range. That distinction matters when resuming downloads or retrieving portions of media files.

ETag vs. Cache-Control

ETag and Cache-Control serve different purposes.

Cache-Control headers establish caching rules, including how long a response can remain fresh. An ETag provides a validator for checking a stored representation.

A fresh cached response may be reusable without contacting the server. When validation becomes necessary, its ETag can help avoid downloading unchanged content. Adding an ETag therefore does not mean that every request must reach the origin, nor does it define a freshness lifetime by itself.

ETags and Media Delivery

A media workflow can produce several variations from one source image: a thumbnail, a larger image, and alternative formats or compression settings.

Validators must describe the representation actually delivered. Copying a source file’s strong ETag onto transformed output without ensuring it identifies those output bytes can produce incorrect validation.

HTTP content encoding matters too. A compressed representation needs a different strong ETag from its uncompressed counterpart because their representation data differs.

QUICK TIPS
Jen Looper
Cloudinary Logo

Here are some tips to better understand ETag:

  1. Validate the delivered representation
    Check ETag behavior after resizing, conversion, and compression.
  2. Keep generation consistent across servers
    Equivalent responses should not acquire arbitrary differences merely because another server handled the request.
  3. Choose validator strength deliberately
    Use strong validators where exact representation matching is required.
  4. Test changed and unchanged content
    Verify both successful revalidation and delivery of updated representations.
  5. Configure caching policy separately
    Pair validators with freshness rules appropriate to the asset’s update requirements.
Last updated: Dec 2, 2026
★★★★★
4.9 (30 reviews)
Talk to Sales Talk to Sales