Hardware FixRecommendedDevice not working? Your driver may be the problemCheck updates for common hardware issues.Fix DriversOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsClean PCRecommendedOne scan can reveal what keeps slowing WindowsLook for cleanup and repair opportunities.Run Scan×
Skip to content
World desk4 min

How to Enable Brotli or Gzip Compression Without Hurting PageSpeed

Enable Brotli or gzip for eligible text responses, verify the encoding and cache headers on real requests, and treat lower transfer size—not a guaranteed PageSpeed score increase—as the goal.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Enable Brotli (br) or gzip for eligible text responses, then verify the headers and cache behavior on real requests. Compression can reduce bytes transferred, but it cannot guarantee a higher PageSpeed Insights score: that score also reflects factors compression does not change.

How Brotli and gzip compression work

HTTP compression is negotiated for each request. A browser can advertise formats it accepts in the Accept-Encoding request header, for example br, gzip. If the server supports and is configured to use one, it returns the selected format in the response’s Content-Encoding header. The exact choice depends on both the request and the server’s capabilities. MDN’s guide to HTTP compression describes gzip as the most common format and Brotli as a newer alternative; the Accept-Encoding reference explains the request header.

As an Amazon Associate I earn from qualifying purchases.

Since the response may differ depending on Accept-Encoding, caches need to know that the header affects representation selection. Send Vary: Accept-Encoding so a cache does not serve a compressed response to a client that cannot use it, or an uncompressed response when a compressed variant is available. MDN explains this cache behavior in its compression guide; Apache’s mod_brotli documentation also covers the Vary header.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Which responses should you compress?

Start with text-heavy responses that your site serves, such as HTML, CSS, JavaScript, and other text-based formats. Check the response’s MIME type and confirm the server actually compresses it. Do not spend effort trying to compress already-compressed formats such as most images, audio, and video; MDN’s compression guidance makes this distinction.

Compression eligibility is not the same as compression being enabled for every file. For example, NGINX’s gzip module uses gzip_types to specify MIME types in addition to text/html. Review the documentation for your server, hosting platform, or CDN rather than assuming that one configuration applies everywhere.

Choose a server-specific deployment path

There is no single universal setting to turn on Brotli or gzip: module availability and configuration depend on the server and its build. Use the documentation for the exact product and version you run, and check whether compression is handled by the origin server, a proxy, or a CDN.

  • Apache: Apache documents Brotli through the mod_brotli output filter, including an option for serving pre-compressed content. For gzip, MDN identifies Apache’s mod_deflate.
  • NGINX: The official ngx_http_gzip_module documentation covers gzip configuration, MIME-type selection, Vary behavior, and the $gzip_ratio variable. This is the gzip module; Brotli may require a separate module, and availability depends on how the deployment was built.
  • IIS: MDN points to IIS’s <httpCompression> configuration element. Confirm the appropriate settings and feature support in documentation for your IIS version; the cited guidance does not establish a version-specific Brotli setup.

Whether to compress on demand or serve pre-compressed files is an operational choice. Compare the transferred bytes for representative assets, response latency and server CPU under your workload, and the availability of the chosen approach on your host. There is no established universal Brotli-versus-gzip ratio or speed result that applies to every site’s assets and configuration.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Validate the response, not just the setting

A configuration directive alone does not prove that visitors receive compressed responses. Inspect representative requests through the same public route your visitors use, including any CDN or proxy in front of the origin. Compare requests that advertise supported encodings with those that do not, and confirm that the returned representation and cache headers match.

  • Request: Check the request’s Accept-Encoding.
  • Response: Check whether Content-Encoding is br, gzip, or absent as expected for that request.
  • Cache behavior: Check for Vary: Accept-Encoding when encoding selection depends on that request header.
  • Asset eligibility: Check the MIME type and whether the response is text-based rather than an already-compressed media file.
  • Transfer result: Compare transferred size for the same representative asset with and without compression, while keeping the requested resource and test path consistent.

If a response is not compressed, investigate whether compression is enabled at the component that actually serves it, whether the MIME type is included, and whether a proxy or CDN changes the behavior. On NGINX, the gzip module’s $gzip_ratio can help inspect its gzip result; it is not a Brotli measurement.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

What compression can—and cannot—do for PageSpeed

Compression can reduce the bytes transferred for eligible responses. That is a useful optimization, but it does not promise a particular score increase or a Core Web Vitals improvement. The effect depends on the page and its other performance bottlenecks.

Google’s PageSpeed Insights overview says PSI reports both Lighthouse lab diagnostics and field data from Chrome User Experience Report (CrUX). Google cautions that lab data may not capture real-world bottlenecks; field data reflects real users. PSI also reports on INP, LCP, and CLS, which compression alone cannot determine.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Google’s separate “Enable Compression” page is deprecated guidance for the PageSpeed Insights API v4. Its gzip audit is historical, not a description of the current PSI interface and not proof that PSI requires gzip instead of Brotli. That page documented proxies or antivirus software changing the headers returned to a client as an explanation for why its old audit might not recognize server compression. If you encounter that specific legacy discrepancy, inspect the response headers seen by the client; do not treat the deprecated audit as a current verdict.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
PC Slower Than It Used to Be?Free scan - under a minute
Crashes, No Sound, or Screen Glitches?Free driver scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.