Content-Encoding

The HTTP Content-Encoding header describes the representation and includes a list of encodings that have been applied to the message.

Usage

The HTTP Content-Encoding header is an ordered list of all encodings that have been applied to the message. This enables the client to decode the representation, returning the resource to its original state. A common example of this is Compression; the transmission time is reduced and the client can recreate the original media after it arrives.

Note

The original content of the message is described by the Content-Type header, whereas the Content-Encoding refers to the current state. If the original resource is encoded, for example, pre-compressed, then this will not be reflected by the HTTP Content-Encoding header.

Example

In this example, the server indicates to the client that the resource was altered first using deflate, followed by br (Brotli).

Content-Encoding: deflate, br

Takeaway

The Content-Encoding header informs the client as to what operations were applied to the resource, and in what order. This information is conveyed so that the client can recreate the original.

See also

Last updated: August 2, 2023