WordPress GZIP Compression Guide

Learn in this guide how to enable GZIP compression for WordPress to make a page load faster in an easy method & keep your website at top speed

WordPress GZIP Compression Guide

Enable GZIP compression for WordPress to make your page load faster in an easy method and keep your website running at top speed, learn in this guide how to activate it.

If you’ve worked with computers for any time, you’ll likely already be familiar with compression. For those who aren’t: compression is a super-useful tool for grouping a bunch of files into one considerably smaller (and more easily transportable) file. Which, for websites, translates into significantly faster page load times. In this article, I’ll look at how to gzip compression works and how you can enable it on your WordPress-powered website.

What is it?

Before moving on to how to implement it, let’s first look at what compression means and how it can help.

Nowadays, almost all modern websites use a mixture of HTML, CSS, and JavaScript, written by programmers in a logical, globally understood way. This result is almost always quite a bit of overhead that serves nothing more than human readability. Furthermore, most programmers will use various design patterns and common elements, leading to a fair amount of repetition.

Compression algorithms such as gzip use the patterns and repetitions found within the text to create a more efficient way of storing data. Let’s look at an example.

Here’s some HTML code to make the text within it display in bold:

<strong>this is bold</strong>

The compressed version of this is pretty long: eNqzKS4pys9LtyvJyCxWAKKk/JwUG32oIC8XALn8Cuo=. However, take a look at what happens when we compress the following:

<strong>this is bold</strong>
<strong>this is bold too</strong>

The compressed version is eNqzKS4pys9LtyvJyCxWAKKk/JwUG32oIC+XDRZphZL8fCQlACNDF0U=. Even though the original text is more than double the size, the compressed version is only 16 characters more — a whopping 32% reduction in size, which means less load and a faster website.

GZIP Compression for WordPress

GZIP-Compression in WordPress
GZIP-Compression in WordPress

It’s important to understand that gzip compression is not something WordPress is responsible for. It’s something that’s handled by the servers themselves (rather than within WordPress), which means that to enable it you’ll have to set things up outside WordPress. Keep reading this guide to learn how to enable WordPress GZIP compression.

Host Company to Enable WordPress GZIP Compression

First things first: since enabling compression requires you to edit (or even create) a sensitive file that isn’t the easiest to work with (known as an ‘htaccess file‘), if you’re in any doubt about what to do, it may be best to ask your host to do it for you. If you’re with a top-notch host with top-notch support, they should be able to set this up for you (if they haven’t already) within a matter of minutes.

Setup WordPress GZIP Compression Guide

An htaccess file is used to give special server instructions, such as redirections, automatically prepending or appending files to specific requests, and, well, all sorts of other neat things. Such as enabling gzip compression! The tricky bit to setting things up yourself is locating and then editing. This troublesome file.

First, you’ll need a way to access the files on your server. The preferred method for most folk will almost certainly be via FTP. However, because a site’s being gzipped file is a ‘dot-file‘ (meaning it’s usually hidden), it’s a little trickier to find than most. Worse still, because it’s a hidden file, if you download it to your computer like a regular file, it’ll remain hidden, making it very troublesome to edit.

Important: if all this sounds a little frightening, then you’re probably best off leaving it until you’ve had a little more experience since this isn’t the place to go into any depth on the necessary basics, such as how to use an FTP client, how to edit files on or off a server, or how to deal with dot-files.

If, on the other hand, you’re already familiar with such things, all you’ll need to do to enable gzip compression is copy and paste the following into your site’s htaccess file:

<ifModule mod_gzip.c>
mod_gzip_on Yes
mod_gzip_dechunk Yes
mod_gzip_item_include file .(html?|txt|css|js|php|pl)$
mod_gzip_item_include handler ^cgi-script$
mod_gzip_item_include mime ^text/.*
mod_gzip_item_include mime ^application/x-javascript.*
mod_gzip_item_exclude mime ^image/.*
mod_gzip_item_exclude rspheader ^Content-Encoding:.*gzip.*

And that’s it, all done! Your text-based content, such as HTML, CSS, and JavaScript, should now be transmitted in its gzip compressed form.

Check Your Work

There are several ways to check whether or not a site’s files are gzipping compressed. With one of the easiest (and most interesting) being by using the excellent GTMetrix site testing tool. Something we’ve covered in a previous article: How to use GTMetrix to Test a Website’s Speed Effectively!

If all is working as it should be (and, as always. So, you may have to clear your site’s cache and/or wait a few minutes for things to take effect). You should be able to see the following within the ‘Waterfall’ section of your site’s GTMetrix results: Simple!

Activate GZIP Compression with WP Super Cache Free Plugin

Enabling GZIP Compression with WP Super Cache

WP Super Cache is a free WordPress caching plugin. This is also a great way to enable GZIP compression on your WordPress site.

First, you need to install and activate the WP Super Cache plugin. Check out our step-by-step guide to installing WordPress plugins for more details.

Once activated, go to Settings – WP Super Cache – Advanced page in your WordPress dashboard. Then just check the “Compress pages so visitors can view them faster” checkbox.

Then you have to scroll down the page and click on the “Update Status” button to save your changes. WP Super Cache can now enable gZip compression on your WordPress site.


Gzip compression is one of those simple speed fixes to add (or have added) to your site. Whether it be powered by WordPress or otherwise. You could miss out on a significant speed boost if you don’t enable it.