Is GZIP Automatically Decompressed by Browser?

All modern browsers can handle a gzip encoded response. In fact, if you look at their requests, they'll have a header that says something along the lines of Accept-Encoding: gzip which is their way of saying to the server that they can handle gzipped responses.

The important part is that your server can return both gzip and uncompressed responses depending on the existence and value of that header. If a client doesn't send the Accept-Encoding header, you shouldn't compress it. If the client does send it, you can optionally encode the response using gzip. Not all content needs to be compressed as it may already be compressed and you're wasting CPU cycles. JPEG images are usually a good example of this. Most likely, IIS is making an intelligent decision here as well and only compressing what is necessary, when necessary.

You can verify IIS is doing what it should be by looking at the response headers coming back from your server and looking for the Content-Encoding: gzip header. That tells the client, or browser, that the content is encoded using gzip compression and it should decompress it appropriately.

All browser based requests (e.g., XHR/AJAX/jQuery, regular requests) will automatically be decompressed without additional effort from you. The browser is the client responsible for determining if it can handle gzip and will add the Accept-Encoding header if it does. Your JavaScript code will receive the uncompressed version of it in your response handler.

TL;DR: Turning it on is usually a good idea and you shouldn't need to do additional work.


If the gzip compression is enabled on the web server, that is, not in the application logic, then the browser will uncompress automatically.

In fact, if the browser doesn't support compression the web server will send the data uncompressed (this info is in the request/response http headers exchanged between browser and web server). Just be aware that compression is ineffective with JPEG and other already compressed formats.