Content-Encoding header

Baseline Widely available *

This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.

* Some parts of this feature may have varying levels of support.

The HTTP Content-Encoding representation header lists the encodings and the order in which they have been applied to a resource. This lets the recipient know how to decode the data in order to obtain the original content format described in the Content-Type header. Content encoding is mainly used to compress content without losing information about the original media type.

Servers should compress data as much as possible, and should use content encoding where appropriate. Compressing already compressed media types, such as .zip or .jpeg, is usually not appropriate because it can increase the file size. If the original media is already encoded (e.g., as a .zip file), this information is not included in the Content-Encoding header.

When the Content-Encoding header is present, other metadata (e.g., Content-Length) refer to the encoded form of the data, not the original resource, unless explicitly stated. Content encoding differs to Transfer-Encoding in that Transfer-Encoding handles how HTTP messages themselves are delivered across the network on a hop-by-hop basis.

Header type Representation header
Forbidden request header No

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-gzip as 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).

dcb

A format that uses the Dictionary-Compressed Brotli algorithm. See Compression Dictionary Transport.

dcz

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

Browser compatibility

desktop mobile
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
Content-Encoding
Chrome – Full support
Chrome 1 (Release date: 2008-12-11)
footnote Full support
Edge – Full support
Edge 12 (Release date: 2015-07-29)
footnote Full support
Firefox – Full support
Firefox 1 (Release date: 2004-11-09)
footnote Full support
Opera – Full support
Opera 15 (Release date: 2013-07-02)
footnote Full support
Safari – Full support
Safari 1 (Release date: 2003-06-23)
footnote Full support
Chrome Android – Full support
Chrome Android 18 (Release date: 2012-06-27)
footnote Full support
Firefox for Android – Full support
Firefox for Android 4 (Release date: 2011-03-29)
footnote Full support
Opera Android – Full support
Opera Android 14 (Release date: 2013-05-21)
footnote Full support
Safari on iOS – Full support
Safari on iOS 1 (Release date: 2007-06-29)
footnote Full support
Samsung Internet – Full support
Samsung Internet 1 (Release date: 2013-04-27)
footnote Full support
WebView Android – Full support
WebView Android 4.4 (Release date: 2013-12-09)
footnote Full support
WebView on iOS – Full support
WebView on iOS 1 (Release date: 2007-06-29)
footnote Full support
br
Chrome – Full support
Chrome 50 (Release date: 2016-04-13)
footnote Full support
Edge – Full support
Edge 15 (Release date: 2017-04-05)
footnote Full support
Firefox – Full support
Firefox 44 (Release date: 2016-01-26)
footnote Full support
Opera – Full support
Opera 36 (Release date: 2016-03-15)
footnote Full support
Safari – Full support
Safari 11 (Release date: 2017-09-19)
footnote
footnote Unsupported before macOS 10.13 High Sierra.
Chrome Android – Full support
Chrome Android 51 (Release date: 2016-06-08)
footnote Full support
Firefox for Android – Full support
Firefox for Android 44 (Release date: 2016-01-26)
footnote Full support
Opera Android – Full support
Opera Android 41 (Release date: 2016-10-25)
footnote Full support
Safari on iOS – Full support
Safari on iOS 11 (Release date: 2017-09-19)
footnote Full support
Samsung Internet – Full support
Samsung Internet 5 (Release date: 2016-12-15)
footnote Full support
WebView Android – Full support
WebView Android 51 (Release date: 2016-06-08)
footnote Full support
WebView on iOS – Full support
WebView on iOS 11 (Release date: 2017-09-19)
footnote Full support
dcb
Experimental
Chrome – Full support
Chrome 130 (Release date: 2024-10-15)
footnote Full support
Edge – Full support
Edge 130 (Release date: 2024-10-17)
footnote Full support
Firefox – No support
Firefox
footnote
footnote See bug 1917965
Opera – Full support
Opera 115 (Release date: 2024-11-27)
footnote Full support
Safari – No support
Safari
footnote No support
Chrome Android – Full support
Chrome Android 130 (Release date: 2024-10-15)
footnote Full support
Firefox for Android – No support
Firefox for Android
footnote
footnote See bug 1917965
Opera Android – Full support
Opera Android 86 (Release date: 2024-12-02)
footnote Full support
Safari on iOS – No support
Safari on iOS
footnote No support
Samsung Internet – Full support
Samsung Internet 28 (Release date: 2025-04-02)
footnote Full support
WebView Android – Full support
WebView Android 130 (Release date: 2024-10-15)
footnote Full support
WebView on iOS – No support
WebView on iOS
footnote No support
dcz
Experimental
Chrome – Full support
Chrome 130 (Release date: 2024-10-15)
footnote Full support
Edge – Full support
Edge 130 (Release date: 2024-10-17)
footnote Full support
Firefox – No support
Firefox
footnote
footnote See bug 1917965
Opera – Full support
Opera 115 (Release date: 2024-11-27)
footnote Full support
Safari – No support
Safari
footnote No support
Chrome Android – Full support
Chrome Android 130 (Release date: 2024-10-15)
footnote Full support
Firefox for Android – No support
Firefox for Android
footnote
footnote See bug 1917965
Opera Android – Full support
Opera Android 86 (Release date: 2024-12-02)
footnote Full support
Safari on iOS – No support
Safari on iOS
footnote No support
Samsung Internet – Full support
Samsung Internet 28 (Release date: 2025-04-02)
footnote Full support
WebView Android – Full support
WebView Android 130 (Release date: 2024-10-15)
footnote Full support
WebView on iOS – No support
WebView on iOS
footnote No support
zstd
Chrome – Full support
Chrome 123 (Release date: 2024-03-19)
footnote Full support
Edge – Full support
Edge 123 (Release date: 2024-03-22)
footnote Full support
Firefox – Full support
Firefox 126 (Release date: 2024-05-14)
footnote Full support
Opera – Full support
Opera 109 (Release date: 2024-03-27)
footnote Full support
Safari – Full support
Safari 26.3 (Release date: 2026-02-11)
footnote
footnote Before macOS 26.3 Tahoe, Safari cannot decode Zstandard responses.
Chrome Android – Full support
Chrome Android 123 (Release date: 2024-03-19)
footnote Full support
Firefox for Android – Full support
Firefox for Android 126 (Release date: 2024-05-14)
footnote Full support
Opera Android – No support
Opera Android
footnote No support
Safari on iOS – Full support
Safari on iOS 26.3 (Release date: 2026-02-11)
footnote Full support
Samsung Internet – Full support
Samsung Internet 27 (Release date: 2024-11-06)
footnote Full support
WebView Android – Full support
WebView Android 123 (Release date: 2024-03-19)
footnote Full support
WebView on iOS – Full support
WebView on iOS 26.3 (Release date: 2026-02-11)
footnote Full support

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support
No support
No support
Experimental. Expect behavior to change in the future.
See implementation notes.

See also