Speed up your site with Gzip - TwentyTwo Digital
Speed up your site with Gzip

Speed up your site with Gzip

What is gzip compression?

Gzip compression is a really easy way to boost the speed of your website and save bandwidth. It works by serving a really small version of a text-based files if the browser is capable of handling them.

How much difference does it actually make?

As illustrated by the below example, it can make a huge difference. Using a css file of 66.7KB in it’s normal form, you can see how it’s compressed down to just 11.KB (a reduction of nearly 83%!). The knock-on effect of this is a total page load of just over 1.5 seconds, and with loading speed becoming an SEO ranking factor, it’s definitely worth integrating.

gzip-difference

How easy is it to implement?

Very little web development skill is involved for this one. There are a few ways to implement it depending on server and website setup, though taking a WordPress website hosted with us as an example, we simply add the following to the root .htaccess file:

# BEGIN GZIP
<ifmodule mod_deflate.c>
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/x-javascript
</ifmodule>
# END GZIP

This uses the mod_deflate Apache module and simply instructs which filetypes are to be compressed.

Once the above is implemented, you can use a site like checkgzipcompression.com to check the gzip compression is working.