Enable gzip compression WordPress Website

Enable Gzip compression in WordPress to speed up your website, boost SEO, and improve user experience.


Enable gzip compression WordPress Website

If your WordPress website feels slow, one of the easiest fixes is enabling Gzip compression. This method reduces the size of your website files (HTML, CSS, JavaScript, etc.) before sending them to visitors. Smaller files load faster, which means better user experience, higher SEO ranking, and improved Core Web Vitals.

In this guide, I’ll show you step by step how to enable Gzip compression in WordPress using different methods.

What is Gzip Compression?

Gzip is a popular compression technology that reduces the size of web pages and resources on the server before sending them to browsers.
For example:

  • A 500 KB CSS file might shrink to just 100 KB with Gzip.
  • Your website loads faster because the browser receives smaller files.

This is why tools like Google PageSpeed Insights and GTmetrix often recommend “Enable Gzip Compression.”

Why Enable Gzip in WordPress?

  • Faster website speed
  • Better SEO rankings (Google loves fast sites)
  • Improved mobile performance
  • Less bandwidth usage
  • Happier visitors who stay longer

How to Enable Gzip Compression in WordPress

You can enable Gzip in different ways depending on your hosting setup.

1. Enable Gzip via .htaccess (Apache Servers)

If your website uses Apache, just edit the .htaccess file in the root directory of WordPress and add this code:


    AddOutputFilterByType DEFLATE text/html text/css text/javascript
    AddOutputFilterByType DEFLATE application/javascript application/x-javascript
    AddOutputFilterByType DEFLATE application/json application/xml
    AddOutputFilterByType DEFLATE application/xhtml+xml application/rss+xml
    AddOutputFilterByType DEFLATE application/font-woff application/font-woff2
    AddOutputFilterByType DEFLATE image/svg+xml

Save changes and clear cache.

2. Enable Gzip via nginx.conf (Nginx Servers)

If your hosting uses Nginx, open your nginx.conf file and add:

gzip on;
gzip_comp_level 6;
gzip_min_length 256;
gzip_proxied any;
gzip_vary on;
gzip_types text/plain text/css application/json application/javascript application/xml text/xml text/javascript application/font-woff application/font-woff2 image/svg+xml;

Restart Nginx after saving.

3. Enable Gzip with WordPress Plugins

If you don’t want to edit server files, use a caching plugin:

  • W3 Total Cache – free option with Gzip settings
  • WP Rocket – premium but very powerful
  • LiteSpeed Cache – best if your server supports LiteSpeed

Just install, activate, and enable “Gzip compression” in settings.

4. Enable Gzip via cPanel

If your hosting has cPanel, follow these steps:

  1. Login to cPanel
  2. Go to Software > Optimize Website
  3. Select Compress All Content
  4. Save changes

How to Check if Gzip is Working

After enabling, you should test if compression works.
Use free tools like:

If you see gzip or br (Brotli), compression is active.

Final Words

Enabling Gzip compression in WordPress is a quick win for website speed and SEO. Whether you do it through .htaccess, Nginx, cPanel, or a plugin, the result will be a lighter, faster, and more user-friendly website.

If you want even better performance, you can also use Brotli compression (newer and more efficient than Gzip).

Next, I recommend checking out my guide on Website Tracking Tools to monitor your site performance.



Text Link Ads

Buy Text Link Ad - $10 per month
Search Free SEO Tools
Sponsored