HTTP Content-Encoding Header
Indicates which compression algorithm was applied to the response body. The client must use the same algorithm to decompress the data.
Purpose
Reduces response payload size by applying compression, improving transfer speed and bandwidth usage.
Content-Encoding: gzip Content-Encoding: br (Brotli) Content-Encoding: deflate Content-Encoding: identity (no encoding)
Code Examples
See how to use the Content-Encoding header in different tools and languages.
Related Headers
Accept-Encoding
Indicates which content encoding (compression algorithm) the client supports. The server may compress the response body using one of these methods.
Content-Type
Indicates the media type (MIME type) of the resource being sent. Tells the client how to interpret the response body.
Content-Length
Indicates the size of the response body in bytes. Helps the client know how much data to expect and when the response is complete.
Transfer-Encoding
Specifies the transfer encoding applied to the message body. Chunked encoding is used when the response size is not known in advance.