Imagine you’re sending a package. Wouldn’t it be great if you could squish it into a smaller box to save on postage? That’s what GZIP does for your website. It squeezes your web files, so they zip across the internet at lightning speed, reaching your audience faster. This isn’t just about speed; it’s about giving your visitors a smooth, slick experience.

What is Gzip?
Gzip stands for “GNU zip.” (“GNU” stands for “GNU’s Not Unix”; it is a recursive acronym and no one knows the actual abbreviation). Gzip is a file compression program launched in 1983 by Richard Stallman to create a completely free and open-source operating system (“public domain software”).
Gzip is widely used by hosting companies to compress and decompress files in the gzip format. Brotli, a data compression algorithm developed by Google, is an alternative to Gzip. Hosting companies enable Gzip and/or Brotli in their servers. Gzip and Brotli can be turned on at the same time, but the server will use one or the other when transmitting data.
Gzip function turned on by hosting companies are used to compress static web pages, so for dynamically generated websites based on WordPress, Gzip feature has to be turned on within WordPress.
How do I know if Gzip is turned on?
Visit this GiftOfSpeed.com/gzip-test page and type in your website address to see if Gzip is turned on.
Just in keep in mind that although your server can use Brotli in combination with GZIP, that does not mean it will use Brotli+GZIP.
How and which compression algorithm will be used depends on a particular website content being pulled and the server configuration.
For example, your server will deliver the content compressed with Gzip to your CDN (i.e. Cloudflare), but your CDN may choose to deliver the content by first decompressing Gzip and the re-compress using Brotli before sending it over to the user. Or your server may send the content using Gzip as-is.
In most cases, if the client (browser) supports both compression algorithm, brotli will be preferred over gzip.
Please note that both are used to compress text files, not binary files like JPEG, PNG, MP4, or other media files (those are compressed by your CDN using different protocols).
How to Turn on Gzip within WordPress
There are two methods to accomplish this:
- Plugin
- A text file called “.htaccess” (click here to read more about htaccess)
Which method you choose depends on if you are currently using a caching plug in or not.
Plugin
Most WordPress caching plugins give you the ability to enable Gzip compression.
Below is a list of popular WordPress caching plugins that can turn on Gzip:
- W3 Total Cache – only if your hosting server is Apache
- WP Super Cache
- WP Rocket
- WP Fastest Cache
You will need to look up their specific instructions to enable Gzip compression.
HTACCESS (Apache or LiteSpeed servers)
If you are already using a caching plugin (I use Litespeed WordPress), you will need to enable Gzip by inserting a small code in the text file called “.htaccess” (the period preceding htaccess denotes the hidden nature of the file).
Step #1a– You need check to make sure that Gzip is supported by your server. To do that, type the following into a notepad
<?php phpinfo(); ?>
Step #1b – Save the file as “test.php” (without the quotes)
Step #2 – Up[load the test.php file (how?)inside the /public-html/wp-content folder of your site:
Step #3 – Open up a browser and type in your website address followed by test.php
https://yourwebsitename.com/test.php
Step #4 – Your website should return something like the following screen. The resulting page is about 3 pages long so press CTRL+F and type in “gzip” to find Gzip.

Step #5 – With that confirmation, we can move on and edit .htaccess file. Before doing anything else, make sure to create a backup copy (cPanel has a COPY function)
Step #6 – Double click on the .htaccess folder (cPanel only) to edit the file. Copy the following code into your .htaccess file and and paste it at the end.
# BEGIN GZIP Compression JavaScript, Text, HTML, CSS, XML and fonts
<IfModule LiteSpeed>
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
</IfModule>
# END GZIP Compression
It is important to NOT paste the above in between any dynamically generated codes.
Once complete, go to Pingdom tool to test your site.
HTACCESS (NGINX server)
Although the majority of hosting companies use Apache/LiteSpeed servers, if your hosting company uses NGINIX, you will have to enable Gzip using a different method by adding this code into the nginx.conf file:
gzip on;
gzip_disable "MSIE [1-6]\.(?!.*SV1)";
gzip_vary on;
gzip_types text/plain text/css text/javascript image/svg+xml image/x-icon application/javascript application/x-javascript;
The Gotchas
- Not all files compress well. Images and videos? They’re already compressed. Squeezing them more won’t do much.
- Beware of the browser compatibility. Older browsers might not play nice with GZIP. But, let’s face it, they’re like the internet’s dinosaurs.
- After you’ve cast your GZIP spell, test your website. Tools like GTmetrix or Google PageSpeed Insights can show you how well your site is performing post-compression.
Conclusion
Enabling GZIP Compression is like giving your website a turbo boost. It’s one of those small changes that can have a big impact on your site’s performance,
Please note: messing with an htaccess file can break your website so make sure to have a backup copy!
Reference Links
- HTaccess – The Beginner’s Guide
- LSWS v5.3 Brotli and gzip – Good information on server configuration (not just the plugin); direct link
- Plesk (cPanel competitor) – Enabling WordPress GZIP Compression
- What is GZIP Compression? – Wp engine