edia/content type is specified in the [ ` Content-Type
` ](/en-US/docs/Web/HTTP/Headers/Content-Type) header, and that the ` Content-
Encoding ` applies to the representation, or "coded form", of the data. If the
original media is encoded in some way (e.g. a zip file) then this information
would not be included in the ` Content-Encoding ` header.

Servers are encouraged to compress data as much as possible, and should use
content encoding where appropriate. Compressing a compressed media type such
as a zip or jpeg may not be appropriate, as this can make the payload larger.

Header type  |  [ Representation header ](/en-US/docs/Glossary/Representation_header)  
---|---  
[ Forbidden header name ](/en-US/docs/Glossary/Forbidden_header_name) |  no   
  
##  Syntax

http

    
    
    Content-Encoding: gzip
    Content-Encoding: compress
    Content-Encoding: deflate
    Content-Encoding: br
    Content-Encoding: zstd
    
    // Multiple, in the order in which they were applied
    Content-Encoding: deflate, gzip
    

##  Directives

` gzip `

    

A format using the [ Lempel-Ziv coding
](https://en.wikipedia.org/wiki/LZ77_and_LZ78#LZ77) (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 ](https://en.wikipedia.org/wiki/LZW)
(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 ](https://en.wikipedia.org/wiki/Zlib) structure (defined in [
RFC 1950 ](https://datatracker.ietf.org/doc/html/rfc1950) ) with the [ deflate
](https://en.wikipedia.org/wiki/Deflate) compression algorithm (defined in [
RFC 1951 ](https://datatracker.ietf.org/doc/html/rfc1951) ).

` br `

    

A format using the [ Brotli ](/en-US/docs/Glossary/Brotli_compression)
algorithm structure (defined in [ RFC 7932
](https://datatracker.ietf.org/doc/html/rfc7932) ).

` zstd `

    

A format using the [ Zstandard ](/en-US/docs/Glossary/Zstandard_compression)
algorithm structure (defined in [ RFC 8878
](https://datatracker.ietf.org/doc/html/rfc8878) ).

##  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 ` ](/en-
US/docs/Web/HTTP/Headers/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
    

Note that the server is not obligated to use any compression method.
Compression highly depends on server settings and used server modules.

##  Specifications

Specification  
---  
[ HTTP Semantics  
#  field.content-encoding  ](https://www.rfc-
editor.org/rfc/rfc9110#field.content-encoding)  
  
##  Browser compatibility

BCD tables only load in the browser  with JavaScript enabled. Enable
JavaScript to view data.

##  See also

  * [ ` Accept-Encoding ` ](/en-US/docs/Web/HTTP/Headers/Accept-Encoding)
  * [ ` Transfer-Encoding ` ](/en-US/docs/Web/HTTP/Headers/Transfer-Encoding)
  * [ Brotli compression ](/en-US/docs/Glossary/Brotli_compression)
  * [ GZip compression ](/en-US/docs/Glossary/GZip_compression)
  * [ Zstandard compression ](/en-US/docs/Glossary/Zstandard_compression)

##  Help improve MDN

Was this page helpful to you?

Yes  No

[ Learn how to contribute
](https://github.com/mdn/content/blob/main/CONTRIBUTING.md "This will take you
to our contribution guidelines on GitHub.") .

This page was last modifie