Gzip Compression WordPress Guide: How to Enable It (5 Methods)

Gzip Compression WordPress Guide: How to Enable It (5 Methods)

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.

WP Rocket - WordPress Caching Pluginused 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.

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/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

# Remove browser bugs in old browsers

BrowserMatch ^Mozilla/4 gzip-only-text/html

BrowserMatch ^Mozilla/4.0[678] 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:

Enable Gzip Compression pluginWP 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.

This plugin is available at WordPress.org, so you can install it like you would any other plugin (though your site does need to be hosted at SiteGround to use it).

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:

Gzip Compression in SG Optimizer pluginWP Fastest Cache is a popular free WordPress caching plugin. In addition to caching, it can also help you enable Gzip compression on your WordPress site.

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:

WP Fastest Cache Gzip settingthis 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:

How to test WordPress Gzip compressionEnable Gzip Compression

  • WP Rocket
  • SG Optimizer (if you host at SiteGround)
  • WP Fastest Cache
  • Do you have any questions about using Gzip compression with WordPress? Ask away and we’ll try to help!

    error: Content is protected !!