Why Google supports GZIP compression for SEO

Does compression matter for good loading speed? If your user keeps waiting for the page to load the user is likely to leave without exploring your website. With the boom of mobile devices, especially in countries with poor internet connectivity, reducing your web page weight is critical for the success with users on mobile.

Why Google supports GZIP compression for SEO

Why Google supports GZIP compression for SEO

GZIP is a generic compressor that can be applied to any stream of bytes, compressing your webpages and style sheets before sending them over to the browser. This drastically reduces transfer time since the files are much smaller.

GZIP performs best on text-based content, often achieving compression rates of as high as 70-90% for large files. All modern browsers support and automatically negotiate GZIP compression for all HTTP requests. Your need to ensure that the server is properly configured to serve the compressed resource when requested by the client.

The idea behind using GZIP is to reduce the traffic between web server and browsers.

 

GZIP is one of the simplest and highest pay off optimizations to implement unfortunately, many people ignore implementing it. Most web servers will compress content on your behalf, and you just need to verify that the server is correctly configured to compress all the content types that would benefit from GZIP compression.

GZIP performs best on text-based assets: CSS, JavaScript, HTML. All modern browsers support GZIP compression and will automatically request it.

Library Size Compressed size Compression ratio
jquery-1.11.0.js 276 KB 82 KB 70%
jquery-1.11.0.min.js 94 KB 33 KB 65%
angular-1.2.15.js 729 KB 182 KB 75%
angular-1.2.15.min.js 101 KB 37 KB 63%
bootstrap-3.1.1.css 118 KB 18 KB 85%
bootstrap-3.1.1.min.css 98 KB 17 KB 83%
foundation-5.css 186 KB 22 KB 88%
foundation-5.min.css 146 KB 18 KB 88%

How can you add GZIP?

You can add GZIP in two different ways depending on whether or not you’ve got an IIS (Internet Information Services) or Apache server.

For IIS

If your server is IIS, follow the instructions in the Microsoft TechNet document to enable compression.

http://technet.microsoft.com/en-us/library/cc771003%28WS.10%29.aspx

For Apache

For Apache you will need to add the following lines to your .htaccess file:

  # Compress HTML, CSS, JavaScript, Text, XML and fonts
  AddOutputFilterByType DEFLATE application/javascript
  AddOutputFilterByType DEFLATE application/rss+xml
  AddOutputFilterByType DEFLATE application/vnd.ms-fontobject
  AddOutputFilterByType DEFLATE application/x-font
  AddOutputFilterByType DEFLATE application/x-font-opentype
  AddOutputFilterByType DEFLATE application/x-font-otf
  AddOutputFilterByType DEFLATE application/x-font-truetype
  AddOutputFilterByType DEFLATE application/x-font-ttf
  AddOutputFilterByType DEFLATE application/x-javascript
  AddOutputFilterByType DEFLATE application/xhtml+xml
  AddOutputFilterByType DEFLATE application/xml
  AddOutputFilterByType DEFLATE font/opentype
  AddOutputFilterByType DEFLATE font/otf
  AddOutputFilterByType DEFLATE font/ttf
  AddOutputFilterByType DEFLATE image/svg+xml
  AddOutputFilterByType DEFLATE image/x-icon
  AddOutputFilterByType DEFLATE text/css
  AddOutputFilterByType DEFLATE text/html
  AddOutputFilterByType DEFLATE text/javascript
  AddOutputFilterByType DEFLATE text/plain
  AddOutputFilterByType DEFLATE text/xml
  # Remove browser bugs (only needed for really old browsers)
  BrowserMatch ^Mozilla/4 gzip-only-text/html
  BrowserMatch ^Mozilla/4\.0[678] no-gzip
  BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
  Header append Vary User-Agent

GZIP compression reduces the bandwidth needed for each request. Although this requires additional CPU time to uncompress the results, it leads to a trade-off with network costs.

You need to avoid using GZIP for image or other binary files. Compressing image file formats supported by the web, as well as videos, PDFs and other binary formats won’t be useful because they already compressed.

For WordPress you can use WordPress Gzip Compression which will speed up your WordPress website drastically and reduce bandwidth usage. This plugin compresses output before it is sent to the user’s browser so the user downloads less data and the browser then processes the compressed data.

 

Christine

Christine

Author at onlineshouter
Christine writes for people who seek for knowledge about SEO, blogging, online marketing, gadgets and web apps.
Christine

Leave a Reply

Your email address will not be published.