Your WordPress site is probably sending visitors files three to four times bigger than they need to be. A 100 KB HTML page can shrink to 15–25 KB with GZIP — most sites can switch it on in under ten minutes. So why do so many still fail Google’s “Enable text compression” audit?
Most site owners never check whether compression is already on — and the ones who try often enable it in the wrong place. This guide fixes both: how to enable GZIP compression in WordPress, how to check it, and when Brotli is the better choice.
What GZIP Does (and Does Not Do)
GZIP is a lossless format that has shrunk web files since the 1990s. When a visitor opens your site, their browser tells the server which formats it supports; if GZIP is enabled, the server compresses your HTML, CSS, and JavaScript before sending them, and the browser decompresses them instantly.
The key takeaway: GZIP typically shrinks text files by 60–80%. A 120 KB stylesheet might arrive as just 25 KB — on slow mobile, that is the gap between a visitor who stays and one who bounces.
One hard limit: GZIP only helps text files. JPEGs, PNGs, WebP images, and videos are already compressed, so GZIP wastes CPU on them. GZIP is for HTML, CSS, JavaScript, JSON, XML, and SVG.
Step 0: Check If GZIP Is Already Enabled
Before you change anything, check whether compression is already working — many hosts and CDNs do it by default.
Here is the fastest check:
- Open your site in Chrome and press F12 to open DevTools.
- Click the Network tab and reload.
- Click any HTML or CSS file and look at the Response Headers.
content-encoding: gzipmeans GZIP is on;content-encoding: brmeans Brotli is on. No header means compression is off.
For example: a blog we audited loaded in 4.2 seconds; the owner was ready to buy faster hosting. A 30-second DevTools check showed no content-encoding header. Compression cut text transfer by 72% and load time to 2.6 seconds. Check first — it often solves the whole problem.
Method 1: Enable GZIP Compression in WordPress From Your Host
Try this first — it is the easiest method. Many shared hosts, including Bluehost, SiteGround, and Hostinger, enable GZIP by default; most others offer a one-click toggle.
In your hosting panel, find Optimize Website under Software, or search for “compression.” Select Compress All Content and save. If your host offers a Brotli toggle too, choose Brotli — roughly 15–25% smaller than GZIP. Then re-check with DevTools.
Method 2: Enable GZIP Compression in WordPress .htaccess (Apache)
On Apache or LiteSpeed — most shared hosting — you can enable GZIP compression in WordPress .htaccess with a few lines of code.
Back up .htaccess before you touch it. A single typo can take your whole site down with a 500 error.
In cPanel File Manager, open your root folder (public_html) and find .htaccess. Paste the block below outside the # BEGIN WordPress markers; never edit inside that block, because WordPress overwrites it:
<IfModule mod_deflate.c>
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE text/javascript
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/json
AddOutputFilterByType DEFLATE image/svg+xml
</IfModule>
This uses Apache’s mod_deflate module. Never use the ancient mod_gzip module — it is deprecated and misbehaves on modern servers.
Save, clear your cache, and re-check with DevTools for content-encoding: gzip.
One warning: never enable GZIP through two methods at once — an .htaccess block plus a plugin that also writes compression rules can trigger 500 errors or garbled pages. Pick one method.
Method 3: Enable GZIP on Nginx
On Nginx — common on VPS and managed hosts like Cloudways — .htaccess does not exist, so the rules go in your server block:
gzip on;
gzip_comp_level 6;
gzip_min_length 256;
gzip_vary on;
gzip_types text/css text/javascript application/javascript application/json image/svg+xml;
GZIP level 6 is the sweet spot. Levels run from 1 to 9, and level 6 delivers nearly the same file size as level 9 in far less time — tests show the gap is under 2%.
The gzip_vary on; line adds Vary: Accept-Encoding so proxies cache both versions separately. Test with nginx -t, then reload Nginx.
Method 4: Use a GZIP Compression Plugin
If editing server files makes you nervous, a WordPress GZIP compression plugin does the same job with a few clicks.
W3 Total Cache (free) enables GZIP under Performance → Browser Cache. WP Rocket (premium) is simpler still: on Apache and LiteSpeed it writes the mod_deflate rules into .htaccess automatically on activation.
Use exactly one plugin — two caching plugins fighting over GZIP cause most of the 500 errors above. If you already run one, check for a compression option before installing anything new.
Method 5: Enable Text Compression With Cloudflare
Here is the trick most tutorials skip: if your site runs behind Cloudflare, you may already have Brotli — no server changes needed.
Cloudflare has supported Brotli since 2017 and compresses proxied traffic automatically, falling back to GZIP when a browser does not support Brotli. Cloudflare removed the old Brotli toggle in 2024; compression is now automatic — see Cloudflare’s Compression Rules for the current options.
Put your site behind Cloudflare’s free plan, proxy the DNS record, and compression just happens — re-check with DevTools for content-encoding: br.
GZIP vs Brotli: Which Should You Choose?
Brotli compresses text roughly 15–25% smaller than GZIP at comparable settings. web.dev puts the advantage at 15–20%, and an October 2026 test on real WordPress files measured 5% on HTML, 11% on CSS, and 25% on a large JavaScript file at Brotli level 11.
The trade-off is CPU: in that same test, Brotli level 11 took about 17 times longer than GZIP on a large file. Use level 4–5 for dynamic HTML; reserve level 11 for static, cached files.
| Feature | GZIP | Brotli | Zstandard |
|---|---|---|---|
| Text savings | 60–75% | 70–80% | Like Brotli, faster |
| Size vs GZIP | Baseline | 15–25% smaller | 10–20% smaller |
| Best for | Universal fallback | Static assets | Dynamic content |
The rule is simple: use Brotli when your host or CDN supports it, and keep GZIP as the fallback.
Zstandard (zstd) is the 2026 newcomer: Chrome and Edge support it since 2024, it matches Brotli’s size but compresses faster. Safari support is still incomplete, so watch it — do not chase it yet.
What Comes Next
Compression is one of the fastest WordPress speed wins — but only one piece of the puzzle. Pair it with browser caching, minifying CSS and JavaScript, and our full WordPress speed guide — the complete checklist.
Your 10-minute action plan: check DevTools first. If compression is on, move on to caching. If it is off, pick one method — host toggle, .htaccess, Nginx, plugin, or Cloudflare — and verify the content-encoding header.
Still slow? The bottleneck is elsewhere — usually images or a heavy theme. See our services page for speed audits, or contact us.
FAQ
How do I know if GZIP is enabled?
Open Chrome DevTools (F12), go to the Network tab, reload, and click any HTML or CSS file. In the Response Headers, content-encoding: gzip means GZIP is on, content-encoding: br means Brotli is on, and no header means compression is off.
GZIP vs Brotli WordPress — which is better?
Brotli — it compresses text 15–25% smaller than GZIP at comparable settings. Use Brotli if your host or CDN supports it; keep GZIP as the fallback — servers negotiate per visitor.
Does GZIP compression slow down the server?
Barely. Level 6 adds a little CPU per request and saves far more in bandwidth and load time. It only bites at extreme settings — GZIP level 9 or Brotli level 11 on dynamic, uncached pages. Static files are compressed once and cached.
How do I enable GZIP without a plugin?
Add the mod_deflate block from Method 2 to .htaccess (Apache/LiteSpeed), or gzip on; to your Nginx server block. Or enable compression in your hosting panel, or put your site behind Cloudflare. Back up .htaccess first, and never enable GZIP through two methods at once.
The Takeaway
Compression is the closest thing WordPress speed optimization has to free money: a ten-minute change that shrinks every text file your site sends by 60–80%. Check first — you might already have it. If not, you now know how to enable GZIP compression in WordPress.