How can I tell if my server is serving GZipped content?
Solution 1
It looks like one possible answer is, unsurprisingly, curl
:
$ curl http://example.com/ --silent --write-out "%{size_download}\n" --output /dev/null
31032
$ curl http://example.com/ --silent -H "Accept-Encoding: gzip,deflate" --write-out "%{size_download}\n" --output /dev/null
2553
In the second case the client tells the server that it supports content encoding and you can see that the response was indeed shorter, compressed.
Solution 2
Update
Chrome changed the way it reports (see original answer if interested). You can tell using Developer Tools (F12). Go to the Network tab, select the file you want to examine and then look at the Headers tab on the right. If you are gzipped, then you will see that in the Content-Encoding.
In this example, slider.jpg is indeed being gzipped.
Compare that to this very page that you are on and look at a png file, you will see no such designation.
Just to be clear, it isn't because one is a jpg and one is a png. It is because one is gzipped and the other one isn't.
Previous Answer
In Chrome, if you pull up the Developer Tools and go to the Network tab, then it will show the following if there is no compression:
And the following if there IS compression:
In other words, the same number, top and bottom, means no compression.
Solution 3
See in the response headers. In FireFox you may check with Firebug.
Content-Encoding gzip
If server supports gzip content then this should be displayed.
Solution 4
In new version of chrome, Developer tools > network, you can right click on Column name, and select content-encoding option and add that column (black box in image).
and if you want to see the size of that gzip content, as @Outfast Source - than you can click on icon which is next to View (displayed as Green box in image).
so you can see which content is gzip enabled.
Solution 5
You could quickly use a web service like: http://www.whatsmyip.org/http-compression-test/
Google Chrome's "Audits" tool in the developer tools comes in handy as well.
Related videos on Youtube
Johnny
Updated on August 24, 2020Comments
-
Johnny over 3 years
I have a webapp on a NGinx server. I set
gzip on
in the conf file and now I'm trying to see if it works. YSlow says it's not, but 5 out of 6 websites that do the test say it is. How can I get a definite answer on this and why is there a difference in the results? -
Maciej Swic almost 12 yearsYou only get this if your client has sent "Accept-Encoding: gzip,deflate"
-
Tyler Biscoe over 10 yearsThis is true, but gzip can be configured to compress certain file types, and exclude others. So be sure that the files you curl using this test are of the type that will be compressed.
-
Samuel about 10 yearsIt may be better to inspect the response headers. This method does not say whether gzip compression is begin used or some other compression algorithm.
-
d48 almost 10 yearsIn Chrome Developer Tools on the Network tab, click on the asset name/link for the request and you can inspect the Response Headers like so and see
gzip
for the Content-Encoding key ![screenshot][1] [1]: i.stack.imgur.com/Bpb5W.png(http://content.screencast.com/users/… -
ptim over 9 yearsHard refresh to see the original file's encoding, as when the file is served with status 304, it seems that the cached version is already unzipped! (in my case, I'm seeing an ETag header rather than Content-Encoding)
-
Andy Dufresne almost 9 yearsThe recent chrome versions (Version 44.0.2403.130 m) do not seem to show the size/content details - I mean the gzip details - i.imgur.com/MTz7DCM.png. Does anyone know the reason why?
-
vladkras over 7 yearsI would suggest using
-L
flag forcurl
too to follow all redirects, e.g. from non-www towww.
otherwise result of size_download may be wrong -
Dan Dascalescu over 5 yearsThis is a great answer, but <kbd>Content-Encoding</kbd> has moved under <kbd>Response Headers</kbd>.
-
Akron about 5 yearsIf I could impress one thing on my younger devs, its the importance of having a solid unix foundation. +1 for CURL. Its confusing at first, a life saver when you know it.