Gzip compression is a way to compress files like HTML, PHP, Javascript, and CSS files so that they are smaller and is really useful in improving how quickly your web pages loads. Below we’ll give a further breakdown of why using Gzip compression is so useful, how to enable it on different web servers, and how to check if it is working.
What is a Gzip compression?
A Gzip is a file format and a software application that is used for both file compression and decompression. First used in early Unix systems in the beginning of the 1990s, compression has evolved to offer a simple and highly effective way to save bandwidth and help your website load and respond quickly. Gzip coding allows for modern browsers to enjoy data heavy web content at speed. Ensuring your website loads quickly is vital to ensuring that your users don’t get bored and head on over to visit the competition instead.
Why use Gzip compression?
As noted in Patrick Sexton’s article, ‘compressing HTML and CSS files with Gzip normally saves 50-70% of the file size’. This means that users have smaller files to download when visiting your pages, so the loading time will be quicker, resulting in a better experience for the users. As all modern browsers understand and accept Gzip compressed files, there’s almost no reason not to do it!
While it could be argued that there are some downsides to using Gzip compression, in general the pros outweigh the cons. For example, while it does take time for the browser to unzip files when transferred, this is normally still shorter than the time saved by providing a smaller file for download.
With this in mind, here are the different ways you can enable Gzip compression for different web servers.
Gzip compression for different web servers
The way to enable Gzip compression differs slightly depending on whether you are using htaccess, Apache, Nginx, or other web servers.
For htaccess and Apache, you need to add a set of code to your .htaccess file (which can be found through the file manager) – Varvy gives a handy copy of the code you can use. In the same article they also provide the code you can use for Nginx, which should be added to your config file.
For other options, such as Gzip compression specific to WordPress (which can be done through the WordPress control panel), Gift of Speed gives a good breakdown of the code and process that can be used.
How to check if your Gzip compression works
There are lots of easy to use online tools that can help you check whether your Gzip compression enabling has worked (or if it your site was even running it already). With both Varvy’s and Check Gzip Compression’s tools, all you need to do is enter your page’s URL. They will then let you know if it is working, and give you details on how much your file sizes have been reduced.