Life's short Live it up!

[How-To] gZip Your Website Content and Improve Performance

December 12th, 2008 · 7 Comments


Whenever someone visits your website, Apache (web server) sends the html, CSS, JavaScripts to the browser uncompressed. If you are running a successful website and get a lot of traffic and have to pay for Bandwidth, gZipping your data before sending it to the browser would be a good option.

Using mod_gzip compression which is an Apache web server module, or one of the other methods of gzip, your server will only send out gzipped content All the new browsers currently in use support gzip. Incase an old browser which doesnt support gZip makes a request, uncompressed HTML will be served.

gZip will work on the following file types: HTML, JS, CSS, JSON, XML

Some advantages of Zipping your data

  • gZip can reduce file sizes by roughly 60%-70%
  • You can save on Bandwidth cost
  • Increase in overall performance of your website
  • Better User Experience as the site will load faster
  • User will save on bandwidth cost too

To check if your site is sending gZipped content or not, use these links

If your server is not sending gZipped data then you can write to your server/hosting company and ask them to enable mod_gzip on the server. You can also tell them the advantages of doing the same. Dreamhost/Mediatemple already has this module enabled. If you are running your own server please ask the system administrator to enable it for you.

More tips coming up soon.


Tags: How To's · Tech · Website

7 responses so far ↓

  • 1 Sathya // Dec 13, 2008 at 7:22 am

    Hey I was reading on this couple of weeks ago thought I’ll implement this on my blog but forgot to do! Thanks!

  • 2 Manan // Feb 18, 2009 at 12:36 am

    Oh this is a cool tip! had heard about gzip but never bothered to check what it is. Will check it out.

  • 3 Saurabh // Feb 18, 2009 at 12:06 pm

    Hey Kunal you forgot to mention that we can even do a gzip-encoding using .htaccess also. So that people who have theire sites hosted on servers can use it:

    # Compress some text file types

    AddOutputFilterByType DEFLATE text/html text/css text/xml application/x-javascript

    # Deactivate compression for buggy browsers

    BrowserMatch ^Mozilla/4 gzip-only-text/html

    BrowserMatch ^Mozilla/4\.0[678] no-gzip

    BrowserMatch \bMSIE !no-gzip !gzip-only-text/html

  • 4 yabate // Apr 18, 2010 at 12:55 am

    Thanks for useful information.

    Now my data savings are
    Original Size: 88.65 KB
    Gzipped Size: 16.32 KB
    Data Savings: 81.59%

  • 5 Juzar // Jun 19, 2010 at 10:15 pm

    Hey dude, This is good info.
    However, just want to share why I chose mod_deflate over mod_gzip :
    1) mod_deflate is faster than mod_gzip since gzip compresses more (slightly). So on every request the webserver has to do that much processing extra.
    2) You need to download and build and install mod_gzip where as comes with the standard apache installation.
    That’s all.

  • 6 Daniel // Aug 19, 2011 at 1:07 pm

    Thanks for sharing useful info. Really nice idea to reduce and save the bandwidth of user.

  • 7 Sandeep Kumar // Nov 18, 2011 at 12:35 pm

    both tools showing different results.

Leave a Comment