Use code PERFMATTERS for an extra 10% off!
  1. Home
  2. Docs
  3. Tips
  4. How to fix the “Enable text compression” warning

How to fix the “Enable text compression” warning

Compression is a method of reducing the size of data without losing any information. Think of it like image optimization, but for HTML, CSS, and JavaScript. You remove redundant data to make the resources smaller for faster transfer and storage.

Hosting providers, CDNs (Cloudflare), and cache plugins typically should add compression headers automatically. However, we still see this missing all the time, many times due to a misconfiguration with hosting or cache. And this leads to seeing the “Enable text compression” warning in PageSpeed Insights.

Enable text compression warning
Enable text compression warning

Choosing a compression method

There are different versions of compression, each with their own pros and cons.

gzip

  • Support across all browsers (caniuse), used since 2008.
  • Moderate compression levels.
  • Fast compression speeds.
  • Fast decompression speeds.

Brotli

  • Baseline support across major browsers (caniuse), used since 2016.
  • High compression levels (smaller file sizes).
  • Slower compression speeds.
  • Moderate decompression speeds.

Zstandard (zstd)

  • Less availability across major browsers (caniuse), used since 2024. No support for Safari yet.
  • High compression levels (default levels usually result in slightly bigger file sizes than Brotli).
  • Very fast compression speeds.
  • Very fast decompression speeds.

As of 2025, we typically recommend using Brotli for most sites that are dealing with assets and pages that have a long cache length set. In our tests, we saw about a 3% decrease in the size of each file when comparing Brotli versus Zstandard. If you have 20+ assets loading, this can add up quick. Also, if the files are cached (say with Cloudflare), this means no decompression is needed. Therefore, it’s better to still take advantage of the smaller files with Brotli, which also currently has better browser support.

Compression levels can be tweaked with each protocol to gain more control over the end file sizes, but most WordPress users won’t have this type of access.

Now if you have a highly dynamic site (pages are uncached or files changing frequently), you might want to consider Zstandard, as the compression speeds could make up for the slightly larger file sizes. Also, in most setups, if Zstandard isn’t supported it will fallback to Brotli or gzip.

With that being said, Brotli and Zstandard are very close these days. Either one of these will be better than gzip. And Zstandard will most likely eventually surpass Brotli as more access to compression levels becomes available and browser support for Safari is added.

How to check for compression

There are multiple ways to check for compression. Check out some of the following tools.

PageSpeed Insights

PageSpeed Insights is probably one of the easiest methods. If you have resources that aren’t compressed, you’ll get a warning to “Enable text compression.”

Enable text compression warning
Enable text compression warning

Third-party tool

There are third-party tools you can also use to check for compression. GiftOfSpeed is a good one. You can input a domain to see if the page itself is compressed, or an individual JS or CSS file.

In the example below, you can see there is an 86.02% savings on a single file just by enabling compression. We’ve seen instances where some assets are compressed (typically dynamically generated resources), and others aren’t. It’s not always an all-or-nothing problem.

Stylesheet not compressed
Stylesheet not compressed

Another alternative tool would be the Brotli Test from KeyCDN.

Chrome DevTools

You can also use Chrome DevTools. Under the “Network” tab you can enable the “Content-Encoding” column. This will show you the compression response:

  • gzip: gzip
  • Brotli: br
  • Zstandard: zstd
Chrome DevTools content-encoding
Chrome DevTools content-encoding

How to enable compression

There are multiple ways to enable compression on both your WordPress site and assets.

Hosting provider

The first method of enabling compression is with your hosting provider. Most modern WordPress hosts will enable some type of compression for you automatically. This means you shouldn’t have to worry about this. However, we see clients all the time that are still dealing with this issue. We’ve even encountered hosts that were deploying compression wrong, or not compressing certain assets.

It’s always good to check with your hosting provider first to ensure compression is configured for everything (your pages and assets).

Manually enabling Brotli in Apache

If you are running on a VPS with Apache, then you can manually enable Brotli by adding the following to your Apache config file. Make sure you have the mod_brotli module installed.

<IfModule mod_brotli.c>
# Enable Brotli compression
BrotliCompressionEnabled on

# Set compression quality (0-11, higher is better compression but slower)
BrotliCompressionQuality 5

# Specify file types to compress
AddOutputFilterByType BROTLI_COMPRESS text/html text/plain text/xml text/css text/javascript application/javascript application/json application/xml

# Optional: Set minimum file size for compression (in bytes)
BrotliCompressionMinLength 256

# Optional: Define browser support
<IfModule mod_headers.c>
# Remove Brotli for older browsers that don't support it
BrowserMatch "MSIE" no-brotli
Header append Vary User-Agent env=no-brotli
</IfModule>
</IfModule>

Manually enabling Brotli in Nginx

If you are running on a VPS with Nginx, then you can manually enable Brotli by adding the following to your Nginx config file. Make sure you have the ngx_brotli module installed.

http {
# Enable Brotli compression
brotli on;

# Set compression level (1-11, higher is better compression but slower)
brotli_comp_level 6;

# Specify MIME types to compress
brotli_types text/plain text/css application/javascript application/json application/xml text/html text/xml;

# Optional: Minimum file size for compression (in bytes)
brotli_min_length 256;

# Optional: Enable Brotli only for specific HTTP versions (e.g., HTTP/2)
# brotli_http_version 1.1;

# Optional: Add Vary header for browser compatibility
brotli_static on; # Serve pre-compressed .br files if available
add_header Vary Accept-Encoding;
}

CDN

One of the easiest ways to compress resources is by using a CDN.

We always recommend Cloudflare, which is what we use on all of our sites. Brotli compression is automatically enabled. However, you can change this to Zstandard if you prefer using a Cloudflare compression rule. We anticipate that Zstandard compression will eventually be the new default at Cloudflare.

Cloudflare Zstandard compression rule
Cloudflare Zstandard compression rule

Other CDNs like KeyCDN and BunnyCDN also provide Brotli compression for your assets.

Cache plugin

If your hosting provider doesn’t provide compression and you aren’t using a CDN, you can also use a cache plugin to implement compression.

We recommend the following caching plugins (all of these work great alongside Perfmatters): 

Enabling gzip in WP Fastest Cache
Enabling gzip in WP Fastest Cache

Resources

Was this article helpful?

Related Articles