WordPress Gzip compression is a way to speed up your WordPress site by compressing the files that your server sends to visitors’ browsers. With a smaller file size, visitors are able to load your website more quickly, which means better user experience and all the other benefits of a quick-loading WordPress site. However, Gzip compression is not enabled by default for your WordPress site, so you’ll typically need to perform some manual actions if you want to enable WordPress Gzip compression.
Thankfully, there are plenty of plugins to help you with this, and it’s also not too complex to just enable it by yourself at a server level.
In this post, I’ll share five different ways to get started with Gzip compression on WordPress so that you can pick your preferred approach. But first, let’s just run over a quick look at what’s happening with Gzip compression for the uninitiated…
What Is WordPress Gzip Compression? How Does It Work?
Gzip compression is a technique to losslessly compress the files involved with your website. In more human terms, that means it decreases the size of your site’s files without changing any of their functionality.
Once enabled, your WordPress site’s hosting server will use Gzip to compress the data that it transfers to your visitors’ browsers. Again, that means a smaller file size and faster page load times.
Overall, enabling Gzip compression can reduce the size of your pages by up to 70%, which is a pretty big improvement.
That’s why performance testing tools like Google PageSpeed Insights, GTmetrix, and Pingdom will commonly tell you to “Enable Gzip compression” or something similar.
Gzip compression is used by 78.3% of websites on the Internet, so this isn’t some “out there” technology – it’s a basic performance optimization tweak that the majority of websites employ.
Enabling Gzip compression takes very little time, and once you’ve enabled it, there’s no ongoing maintenance – it will just keep working in the background to speed up your website.
Now, let’s get into some different methods that you can use to enable Gzip compression on WordPress.
Article Continues Below
How to Enable Gzip Compression on WordPress (5 Methods)
To enable Gzip compression, you can add some code to your site’s .htaccess file or use one of the many plugins that enable this functionality.
1. Add Code to Your .htaccess File (Apache Web Server)
If your host uses the Apache web server, which most WordPress hosts do (especially those on the budget end of the spectrum), you can enable Gzip compression by adding some lines to your site’s .htaccess file.
To edit this file, you’ll need to connect to your WordPress site via FTP. If you’re not sure how to do that, you can follow our WordPress FTP guide.
Once you’re connected to your site, find and edit your .htaccess file. However, before making any changes to this file, I would highly recommend downloading a backup copy of the original file to your computer. That way, you always have a working copy if something goes wrong.
Once you have a backup copy of your .htaccess file, add the following lines of code to the bottom of the .htaccess file:
# Enable Gzip compression
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/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/plain
AddOutputFilterByType DEFLATE text/xml
# Remove browser bugs in old browsers
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4\.0 no-gzip
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
Header append Vary User-Agent
2. Use the Enable Gzip Compression Plugin
If you don’t want to mess around with your site’s .htaccess file, there are also several plugin methods that you can use to enable Gzip compression on WordPress.
The first is the aptly named Enable Gzip Compression plugin, which is available for free at WordPress.org.
Once you install and activate the plugin, go to Settings → Gzip Compression and click the Enable Gzip compression button:
You should then see a confirmation message that “Gzip compression is now enabled and working”. That’s it! You’re good to go.
3. Use a Comprehensive Performance Plugin Like WP Rocket
WP Rocket is a comprehensive WordPress performance plugin that aims to speed up your WordPress site in a variety of ways, including caching, lazy loading, minification, and more. You can see all the features in our full WP Rocket review.
One of those techniques is Gzip compression, which WP Rocket automatically enables as soon as you activate the plugin. There’s nothing to configure – just activate the WP Rocket plugin and your site will start benefiting from Gzip compression.
4. Use the SG Optimizer Plugin (If Hosting at SiteGround)
Here at WPLift, we recommend SiteGround as one of the best WordPress hosts, and it’s also the actual WordPress host that we use to run WPLift.
As such, we had to give a special section to SiteGround because SiteGround makes it super easy to enable Gzip compression on your WordPress site via its free SG Optimizer plugin.
Once you’ve activated the plugin, go to the new SG Optimizer tab in your WordPress dashboard. Then, head to the Environment Optimization tab and use the toggle to enable Gzip compression:
5. Use the WP Fastest Cache Plugin
Once you install and activate the free plugin from WordPress.org, head to the new WP Fastest Cache area in your WordPress dashboard. Then, check the box to enable Gzip and save your changes:
How to Test if Gzip Compression is Working on Your WordPress Site
Once you’ve enabled Gzip compression via one of the methods above, there are some free online tools that you can use to check whether or not Gzip compression is working on your site.
I like this tool from Varvy because it will not just tell you whether or not Gzip compression is working, but also the compression level that your site is achieving.
All you do is enter your URL and hit Test. Then, the tool will spit back the results:
Get Started With WordPress Gzip Compression Today
Enabling Gzip compression on your WordPress site is a no-brainer way to shrink the size of your site’s files and speed up your page load times.
It’s easy to enable, low-maintenance, and won’t change any of your site’s functionality.
To get started, you can manually enable Gzip compression via your site’s .htaccess file. Or, many WordPress performance plugins also make it easy to enable Gzip compression. Good options are:
Do you have any questions about using Gzip compression with WordPress? Ask away and we’ll try to help!