// http header · request header

Accept-Encoding

Content encodings the client accepts

What the Accept-Encoding header does

Accept-Encoding lists the compression algorithms the client understands, like gzip and br (Brotli). The server compresses the body with one of them and names its choice in the Content-Encoding response header, cutting transfer size significantly.

Example

Accept-Encoding: gzip, br

Accept-Encoding in practice

Typical browser request

Accept-Encoding: gzip, deflate, br, zstd

Common Accept-Encoding questions and problems

Which values are common?

gzip, deflate, br (Brotli) and zstd. Browsers send a list such as gzip, deflate, br, zstd; the server picks one and names it in Content-Encoding.

How do I test compression with curl?

Use curl --compressed -I URL or send the header yourself: curl -H 'Accept-Encoding: br' -I URL, then check Content-Encoding in the response.

What is identity?

identity means no compression. Accept-Encoding: identity asks for the body as is, and q=0 on an encoding forbids it.

Why does my cache serve compressed content to a client that cannot read it?

Responses that vary by encoding must send Vary: Accept-Encoding so caches keep each variant separate.

Accept-Encoding vs related headers

  • Content-Encoding: Accept-Encoding is the client's request. Content-Encoding is the server's statement of what it actually applied.
  • Accept: Accept is about media type; Accept-Encoding is about compression.

Where it's used

Accept-Encoding is a request header. Request headers are sent by the client to describe the request and what the client can accept.

Other request headers