Enable GZIP Compression WordPress - Smaller Text Files, Faster Pages (2026)

Compression shrinks your HTML, CSS and JavaScript before they're sent, often to a fraction of their original size. Most WordPress hosts already enable it, but it's worth checking.

What Compression Does

Text files compress very well because they're full of repeated patterns. Your server compresses files before sending them, and the browser decompresses them on arrival. The result is fewer bytes over the network and faster downloads, especially on mobile.

GZIP is the long-standing standard. Brotli is a newer format that usually compresses text a bit smaller, and modern browsers support it. Both work automatically once enabled on the server.

Which Files Should Be Compressed

Illustration for Which Files Should Be Compressed on the Enable GZIP Compression WordPress page, showing a compare diagram
Compression by file type
File TypeCompress?Why
HTMLYesText, compresses well
CSS and JavaScriptYesText, compresses well
SVG imagesYesText-based
JSON and XML (feeds, sitemaps)YesText-based
Fonts (WOFF2)NoAlready compressed
JPEG, PNG, WebP, AVIFNoAlready compressed; little gain
Video and audioNoAlready compressed

How to Check If Compression Is On

  1. Open DevTools

    Visit your page and open the Network panel.

  2. Click the document or a CSS file

    Look at the response headers.

  3. Find Content-Encoding

    A value of gzip or br (Brotli) means compression is working.

  4. Check PageSpeed Insights

    Missing compression shows up in the Document request latency insight in current Lighthouse versions.

How to Enable Compression

Ways to enable compression
MethodWhen to Use
Your host's settingsMost managed and shared hosts enable it by default or offer a toggle
WP RocketAdds GZIP rules automatically on Apache servers via .htaccess
Server configurationOn NGINX or custom servers, configure GZIP or Brotli in the server config
CDNCloudflare and many CDNs compress text files automatically, often with Brotli

If you use WP Rocket on Apache, GZIP compression is one of its automatic optimizations, with no setting to enable. On NGINX servers, .htaccess rules don't apply, so ask your host to confirm compression is on.

How Much Compression Saves

Illustration for How Much Compression Saves on the Enable GZIP Compression WordPress page, showing a speed diagram
Typical compression results for text files
FileUncompressedWith Compression
HTML pageLargerOften a fraction of the original size
Theme stylesheetLargerUsually much smaller
JavaScript libraryLargerUsually much smaller
Minified fileAlready smallerCompresses a bit further

Exact ratios vary, but text files commonly shrink substantially. That's why missing compression is one of the most important basics to fix if it's off.

Compression on Different Hosts

Where compression is usually configured
Hosting SetupWho Handles Compression
Shared hosting with ApacheThe host, or your caching plugin via .htaccess
LiteSpeed hostingThe server, usually on by default
Managed WordPress hostingThe host, almost always on
NGINX VPSYour server configuration or control panel
Any host behind CloudflareCloudflare compresses text sent to visitors

If you're behind a CDN, the CDN often handles compression for visitors regardless of your server's settings. Compression on your server still matters for the connection between the CDN and your server.

Troubleshooting Compression

Headers show no Content-Encoding

Compression is off, or a proxy is removing it. Check with your host.

Compressed only some files

Server rules may only cover certain file types. Make sure CSS, JavaScript, SVG and JSON are included.

Double compression errors

Rare, but caused by compressing in PHP and at the server. Use server-level compression only.

Garbled pages after changes

Clear all caches; an old cached file with the wrong headers may be served.

GZIP vs Brotli

Illustration for GZIP vs Brotli on the Enable GZIP Compression WordPress page, showing a compare diagram

Brotli generally produces smaller text files than GZIP at typical settings, which means slightly faster downloads. Many CDNs and modern hosts serve Brotli to browsers that support it and fall back to GZIP for others.

If your CDN offers Brotli, it's worth enabling there. You don't need to choose between them on your server; the browser and server negotiate the best supported option.

A Worked Example

A small site on a basic VPS scores poorly on Document request latency in PageSpeed Insights. Checking the response headers shows no Content-Encoding on the HTML or CSS files, because the server was set up without compression.

The site runs NGINX, so .htaccess rules wouldn't apply. The owner enables GZIP in the server control panel and also turns on the site's Cloudflare proxy, which serves Brotli to supporting browsers. HTML and CSS transfer sizes drop sharply, and FCP improves on mobile connections.

Quick Compression Checklist

Compression and Minification

Compression and minification complement each other. Minification removes unnecessary characters like whitespace and comments; compression then shrinks what's left. Minified files compress a little smaller, but compression does most of the work. See minifying CSS and JavaScript.

Enable GZIP Compression WordPress FAQ

Is GZIP compression enabled on WordPress by default?

Not by WordPress itself, but most hosts and CDNs enable it at the server level.

Does WP Rocket enable GZIP?

Yes, automatically on Apache servers through .htaccess rules.

Should I compress images with GZIP?

No. Images are already compressed. Compression is for text files like HTML, CSS and JavaScript.

Is Brotli better than GZIP?

It usually compresses text a little smaller. Use it if your host or CDN supports it.