Content-Encoding header - HTTP | MDN
Syntax
http
Content-Encoding: gzip
Content-Encoding: compress
Content-Encoding: deflate
Content-Encoding: br
Content-Encoding: zstd
Content-Encoding: dcb
Content-Encoding: dcz
// Multiple, in the order in which they were applied
Content-Encoding: deflate, gzip
Directives
gzip-
A format using the Lempel-Ziv coding (LZ77), with a 32-bit CRC. This is the original format of the UNIX gzip program. The HTTP/1.1 standard also recommends that the servers supporting this content-encoding should recognize
x-gzipas an alias, for compatibility purposes. compress-
A format using the Lempel-Ziv-Welch (LZW) algorithm. The value name was taken from the UNIX compress program, which implemented this algorithm. Like the compress program, which has disappeared from most UNIX distributions, this content-encoding is not used by many browsers today, partly because of a patent issue (it expired in 2003).
deflate-
Using the zlib structure (defined in RFC 1950) with the deflate compression algorithm (defined in RFC 1951).
br-
A format using the Brotli algorithm structure (defined in RFC 7932).
zstd-
A format using the Zstandard algorithm structure (defined in RFC 8878).
dcbExperimental-
A format that uses the Dictionary-Compressed Brotli algorithm. See Compression Dictionary Transport.
dczExperimental-
A format that uses the Dictionary-Compressed Zstandard algorithm. See Compression Dictionary Transport.
Examples
Compressing with gzip
On the client side, you can advertise a list of compression schemes that will be sent along in an HTTP request. The Accept-Encoding header is used for negotiating content encoding.
http
Accept-Encoding: gzip, deflate
The server responds with the scheme used, indicated by the Content-Encoding response header.
http
Content-Encoding: gzip
Whether a server uses compression methods requested by the client depends on server configuration and capabilities.
Specifications
| Specification |
|---|
| HTTP Semantics # field.content-encoding |