How to Enable GZIP Compression in WordPress

When a visitor loads your WordPress site, their browser requests files from your server — HTML, CSS, JavaScript. By default, those files are sent exactly as they are: uncompressed.

GZIP compression changes this. Before sending a file, the server compresses it. The browser receives the smaller package, decompresses it instantly, and uses it. The end result for the visitor is identical, but the file they downloaded was 60–80% smaller.

This is one of the easiest and most reliable performance improvements you can make on a WordPress site.

How to Check If GZIP Is Already Enabled

Open Chrome, go to your website, press F12, go to the Network tab, reload the page, click on your main HTML file, and look for Content-Encoding: gzip or Content-Encoding: br in the Response Headers.

If you see either, compression is already active. If there is no Content-Encoding header, compression is not enabled.

You can also use GiftOfSpeed GZIP Test — enter your URL and it will tell you instantly.

Method 1: Enable GZIP via .htaccess (Apache servers)

Add this to your .htaccess file, above the WordPress rules:

<IfModule mod_deflate.c>
  AddOutputFilterByType DEFLATE text/html text/css text/javascript
  AddOutputFilterByType DEFLATE application/javascript application/x-javascript
  AddOutputFilterByType DEFLATE application/json application/xml
  AddOutputFilterByType DEFLATE font/ttf font/otf image/svg+xml
</IfModule>

Always back up your .htaccess before editing. A syntax error takes your site offline.

Method 2: Via a WordPress caching plugin

Most caching plugins handle GZIP automatically:

WP Rocket enables it automatically on installation. Check Settings > WP Rocket > Dashboard for the Compression feature.

W3 Total Cache: Performance > Browser Cache > Enable HTTP (gzip) compression.

Method 3: Via Cloudflare

If your site is behind Cloudflare, GZIP and Brotli compression are enabled automatically on all plans. No configuration needed.

GZIP vs Brotli

Brotli is a newer compression algorithm that achieves 15–25% better compression than GZIP. All modern browsers support it. Most modern servers support both — serving Brotli to browsers that support it and GZIP as fallback.

What GZIP Does Not Fix

GZIP compresses files in transit. It does not help with slow server response (TTFB) — if your server takes 1.5 seconds to respond, GZIP does not change that. It is one component of a performance stack, not a complete solution.

Run your site through the HigherHost speed test to see all performance issues across your key pages.


HigherHost provides managed WordPress and WooCommerce hosting with GZIP and Brotli compression enabled by default. View our hosting plans.

©2026 Higher Host. All Rights Reserved.