Weak ETag

Caching

A weak ETag indicates semantic equivalence—the content is functionally the same even if bytes differ. Useful for content with timestamps, personalized ads, or minor variations. Format: W/"abc123" (note the W/ prefix)

Updated Apr 3, 2026

Full Explanation

A weak ETag indicates that two representations of a resource are semantically equivalent, even if they are not byte-for-byte identical. The format uses a W/ prefix before the quoted string: ETag: W/"abc123". This tells caches and clients that the content is functionally the same, even though the actual bytes might differ slightly.

This matters for dynamic pages. Think of a blog post page that includes a "rendered 0.3 seconds ago" timestamp or a different ad placement on each response. The actual article content has not changed, but the bytes are different every time. A strong ETag would break here because no two responses are identical. A weak ETag says "close enough" and still allows 304 Not Modified responses.

Weak ETags work with If-None-Match for conditional GET requests, just like strong ETags. However, they cannot be used for byte-range requests because partial content requires exact byte alignment. If your server sends ETag: W/"v2.1" and the client sends If-None-Match: W/"v2.1", the server can still return 304 if the content is semantically unchanged.

// Response with weak ETag
HTTP/1.1 200 OK
ETag: W/"post-42-v7"
Content-Type: text/html
Cache-Control: max-age=60

// Conditional request using weak ETag
GET /blog/post-42 HTTP/1.1
Host: example.com
If-None-Match: W/"post-42-v7"

// Server responds 304 if post content unchanged
HTTP/1.1 304 Not Modified
ETag: W/"post-42-v7"

Interactive Animation

Loading animation...

Examples

Many web frameworks generate weak ETags by default for dynamic responses. Rails, for example, uses stale? with an object's updated_at timestamp to generate weak ETags automatically.

# Rails controller example
def show
  @article = Article.find(params[:id])
  if stale?(@article)
    render :show
  end
end
# Produces: ETag: W/"a1b2c3d4..."
# Returns 304 if article hasn't been updated

Frequently Asked Questions

A weak ETag indicates semantic equivalence—the content is functionally the same even if bytes differ. Useful for content with timestamps, personalized ads, or minor variations. Format: W/"abc123" (note the W/ prefix)

Many web frameworks generate weak ETags by default for dynamic responses. Rails, for example, uses stale? with an object's updated_at timestamp to generate weak ETags automatically.

# Rails controller example
def show
  @article = Article.find(params[:id])
  if stale?(@article)
    render :show
  end
end
# Produces: ETag: W/"a1b2c3d4..."
# Returns 304 if article hasn't been updated