DevKits

Content · Response header

Content-Encoding

How the body has been transparently encoded (usually compressed).

What is Content-Encoding?

Content-Encoding tells the client that the payload has been transformed — typically compressed with gzip, br (Brotli), or deflate — and must be decoded before the underlying Content-Type applies. Enabling compression can cut transfer size by 70–90%.

Typical usage

Set by servers when serving compressed responses. Clients advertise which encodings they accept with Accept-Encoding.

Examples

Brotli-compressed HTML

Content-Encoding: br

gzip-compressed JSON

Content-Encoding: gzip

Common gotchas

Do not confuse Content-Encoding (transport transformation) with the media type application/gzip (the resource itself is a gzip file). The two mean different things.

Specification

RFC 9110 §8.4

Frequently asked questions

What is the Content-Encoding HTTP header?

Content-Encoding tells the client that the payload has been transformed — typically compressed with gzip, br (Brotli), or deflate — and must be decoded before the underlying Content-Type applies. Enabling compression can cut transfer size by 70–90%.

Is Content-Encoding a request or response header?

Content-Encoding is a response header — the server sends it to the client. Set by servers when serving compressed responses. Clients advertise which encodings they accept with Accept-Encoding.

What does a Content-Encoding header look like?

A typical Content-Encoding header looks like: Content-Encoding: br (Brotli-compressed HTML).

What are common mistakes with Content-Encoding?

Do not confuse Content-Encoding (transport transformation) with the media type application/gzip (the resource itself is a gzip file). The two mean different things.

Related headers

Work with this header