Brotli compression makes text files smaller than GZIP. Pages download faster on the same connection. On real WordPress files I measured savings of 5% to 25% over GZIP depending on the file and the compression level.
I ran these tests in October 2026. I fetched this site’s HTML through Cloudflare with each encoding, and compressed WordPress 7.1.3 core files with GZIP, Brotli and Zstandard at several levels. I also enabled GZIP on a test Apache server with a .htaccess rule and checked the response.
This guide covers how each method works, the test numbers and which one to use. It also shows how to turn compression on for a WordPress site and how to check that it works.
What Is Brotli Compression?
Brotli compression is a lossless format that Google released in 2015 and the IETF published as RFC 7932 in 2016. It shrinks text such as HTML, CSS and JavaScript before the server sends it. Browsers ask for it with br in the Accept-Encoding header and unpack it on arrival.
Brotli has three advantages over older formats:
- Built-in dictionary: It ships with a dictionary of about 120 KB of common words and code fragments. Even small files compress well.
- Larger window: It can look much further back in a file for repeated text.
- Wide level range: Levels run from 0 to 11. You can trade CPU time for size.
The Brotli specification, RFC 7932, defines the format and the built-in dictionary. Every current version of Chrome, Edge, Firefox and Safari supports it over HTTPS.
Brotli was built for the web from the start. GZIP began as a tool for compressing files on disk and was adapted to web traffic later. It has no built-in dictionary at all.
That difference matters most on small files. A short CSS or JSON response has few repeats of its own. The built-in dictionary does much of the work.
What Is GZIP Compression?
GZIP is the older web compression format, published as RFC 1952 in 1996 and based on the DEFLATE algorithm. Almost every server, CDN and browser supports it. It compresses fast with little CPU, which is why it is still the safe fallback when Brotli is not available.
GZIP levels run from 1 to 9. Most servers default to level 6, which gives nearly the same size as level 9 in less time.
Level 1 is the fastest and gives the biggest files, while level 9 is the slowest and gives the smallest. On my test files the gap between 6 and 9 was under 2%.
You will also see the name “deflate” in server settings. Deflate is the raw algorithm inside GZIP. Apache’s GZIP module is even called mod_deflate, yet the response it sends is labeled Content-Encoding: gzip.
So in the deflate vs gzip question, the files come out almost the same size. Use GZIP, because browsers handle raw deflate responses inconsistently.
Brotli vs GZIP: Test Results on WordPress Files
In my tests Brotli made every file smaller than GZIP. The gap was 5% on live HTML served by Cloudflare, 11% on a CSS file and 25% on a large JavaScript file at level 11. Brotli level 11 also took about 17 times longer to compress that file.
First I fetched this site’s homepage with each encoding through Cloudflare:

The uncompressed HTML was 147,269 bytes. GZIP brought it to 22,770 bytes and Brotli to 21,565 bytes, a further 5% saving. Cloudflare compresses dynamic HTML on the fly at a low level, which is why the gap is small.
Then I compressed WordPress core’s block-editor.js file, which is 3.78 MB, at several levels:

Here are all the results in one table:
| File | Original | GZIP 6 | GZIP 9 | Brotli 5 | Brotli 11 | Zstd 3 |
|---|---|---|---|---|---|---|
| Homepage HTML | 159,839 | 24,941 | 24,824 | 22,215 | 19,559 | 25,093 |
| Theme CSS | 27,122 | 6,216 | 6,194 | 5,936 | 5,500 | 6,843 |
| block-editor.js | 3,779,971 | 684,790 | 674,026 | 607,649 | 508,254 | 720,256 |
Sizes are in bytes. GZIP level 9 compressed block-editor.js in 0.26 seconds, while Brotli level 11 took 4.54 seconds.
That cost is fine for a file compressed once and cached. It is too slow to repeat on every request.
Brotli vs GZIP: Key Differences
The main differences are size, speed and where each one works best. Brotli wins on size, and GZIP wins on compression speed and support on old systems. Both unpack quickly in the browser. Visitors see no slowdown from either format.

Here is how they compare point by point:
- File size: Brotli files were 5% to 25% smaller in my tests.
- Compression speed: GZIP is faster, and Brotli at level 11 was 17 times slower on a large file.
- Decompression speed: Both unpack fast in the browser, and I saw no visible difference on normal pages.
- Levels: GZIP runs from 1 to 9 and Brotli from 0 to 11.
- Support: All current browsers support both but Brotli needs HTTPS.
- Best use: Brotli for static files compressed ahead of time and GZIP as the fallback.
The best setup uses both. The browser lists the formats it accepts, and the server picks the best one it supports. My Apache test showed this fallback in action: the browser asked for br, gzip, and the server answered with GZIP because it had no Brotli module.
Gzip vs Brotli for Core Web Vitals
Smaller files reach the browser sooner. That helps Largest Contentful Paint when the HTML and CSS are on the critical path. Moving from GZIP to Brotli saved about 1.2 KB on my homepage HTML. That is a small gain. Treat the format choice as one small part of speed work.
The bigger win is turning compression on at all. In my Apache test, the WordPress block library stylesheet dropped from 164,523 bytes to 22,854 bytes once GZIP was enabled. That is an 86% saving from one rule.
Google’s Lighthouse text compression audit flags any text file sent without GZIP, Brotli or a similar format. If that audit passes, switching formats will only shave a few kilobytes more.
Mobile visitors gain the most. On a slow 4G connection, every kilobyte saved on render blocking CSS shortens the wait before the first paint.
Server CPU matters for the time to first byte. High Brotli levels on dynamic pages can slow the response, which is why CDNs use low levels for HTML built on each request.
Is Zstandard Better Than Brotli?
Zstandard, or zstd, is a newer format that browsers started supporting in 2024. It compresses very fast, but in my tests it produced the largest files of the three at level 3. Cloudflare now serves it to browsers that ask for it.
When I asked Cloudflare for zstd alone, my homepage came back at 22,894 bytes. That is slightly bigger than GZIP and 6% bigger than Brotli.
The real browser header gave a more interesting result. With Chrome’s gzip, deflate, br, zstd, Cloudflare served the dynamic homepage as zstd. The cached theme stylesheet came back as Brotli.
So on Cloudflare, visitors in Chrome may already get zstd for HTML and Brotli for static files. You do not have to choose, because the CDN picks per request.
Zstd shines where compression speed matters more than size, such as large dynamic responses. The Zstandard specification, RFC 8878, defines the format. For a WordPress site today, Brotli plus a GZIP fallback is still the better pair.
How to Enable Brotli and GZIP on WordPress
The easiest way to enable Brotli on WordPress is a CDN such as Cloudflare, which compresses for you. On your own server, enable GZIP with mod_deflate on Apache or the gzip directive on Nginx. Brotli needs an extra module, mod_brotli or ngx_brotli, and your host must install it.
Enable Brotli Through Cloudflare
Cloudflare turns Brotli on for every site. There is nothing to switch on. It removed the old Brotli toggle in 2024. The Cloudflare content compression docs explain that it compresses with Brotli or GZIP based on what the browser accepts.
Cloudflare also accepts Brotli files from your server. If your origin already sends Brotli, Cloudflare can pass it on without compressing it again.
Enable GZIP on Apache With .htaccess
On Apache, add this rule to the .htaccess file in your WordPress folder, outside the # BEGIN WordPress block:
<IfModule mod_deflate.c> AddOutputFilterByType DEFLATE text/html text/css text/plain text/xml application/javascript application/json image/svg+xml </IfModule>
I tested this exact rule on a WordPress test site running Apache:

Enable Brotli on Apache
Apache 2.4.26 and later include mod_brotli, but many hosts do not load it. If yours does, add this rule next to the GZIP one:
<IfModule mod_brotli.c> AddOutputFilterByType BROTLI_COMPRESS text/html text/css text/plain text/xml application/javascript application/json image/svg+xml </IfModule>
The Apache mod_brotli documentation lists the quality and window settings. The IfModule wrapper keeps the site running if the module is missing.
Enable GZIP and Brotli on Nginx
On Nginx, GZIP is built in. Brotli needs the ngx_brotli module compiled in or loaded:
gzip on; gzip_comp_level 6; gzip_types text/css text/plain application/javascript application/json image/svg+xml; brotli on; brotli_comp_level 5; brotli_types text/css text/plain application/javascript application/json image/svg+xml;
Nginx always compresses text/html once compression is on. It does not need to be in the list. Reload Nginx after the change and test it.
Use a Caching Plugin
Many caching plugins add the GZIP rule to .htaccess for you. On managed hosts, compression is usually already on at the server or CDN. If you are unsure what your host runs, a well planned website structure with fewer, cached files helps whichever format you use.
How to Check Which Compression Your Site Uses
Check the Content-Encoding header in the response for each file you care about. It reads br for Brotli, gzip for GZIP and zstd for Zstandard. You can see it in the browser’s developer tools, in an online checker or with one curl command.
Use any of these:
- Browser tools: Open DevTools, go to the Network tab, click the page request and look for content-encoding under Response Headers.
- Command line: Run
curl -sI -H "Accept-Encoding: br, gzip" https://example.com/ | grep -i encoding. - Lighthouse: Run a report and look for the Enable text compression audit.
Test a CSS or JavaScript file as well as the page itself. Some servers compress HTML but skip static files.
Send the same Accept-Encoding header a real browser sends, or the result can mislead you. Chrome sends gzip, deflate, br, zstd, while a bare curl request sends nothing and gets an uncompressed file.
Also test from a logged out browser. Many caching setups skip logged in users. An admin can see different headers from a visitor.
Brotli or GZIP: Which Should You Use?
Use Brotli wherever your server or CDN supports it, and keep GZIP on as the fallback. Compress static files at a high Brotli level once, and use a low level for dynamic HTML. If you cannot add Brotli, GZIP alone still gives most of the savings.
A simple rule set:
- On Cloudflare: Do nothing, because Brotli and GZIP are already on.
- On Apache: Enable
mod_deflate, and addmod_brotliif your host loads it. - On Nginx: Enable GZIP, and add
ngx_brotliif you control the server. - For static files: Pre-compress at Brotli level 11 if your build tools support it.
Leave images out of the compression rules. JPEG, PNG, WebP and AVIF files are already compressed. A text format only adds CPU work.
Compression is only one piece of a fast WordPress site. Server software matters too, and our look at whether PHP is still relevant covers how modern PHP versions speed up the WordPress side.
Heavy third-party scripts can undo the savings. A large CAPTCHA script is a common example, and our list of reCAPTCHA alternatives includes lighter options.
Conclusion
Brotli compression beats GZIP on size in every test I ran. The gain was 5% on live HTML and up to 25% on a large JavaScript file. GZIP compresses faster and works everywhere. It stays as the fallback.
The biggest gain comes from turning compression on at all. One .htaccess rule cut a WordPress stylesheet by 86%.
Use Brotli where you can and keep GZIP behind it. Then check the Content-Encoding header to confirm what visitors get.
Frequently Asked Questions (FAQs)
Q1. What is the difference between Brotli and GZIP?
Both are lossless compression formats for web files. Brotli is newer and makes smaller files thanks to a built-in dictionary and higher levels. GZIP is older, faster to compress and supported by nearly every server.
Q2. Is Brotli always smaller than GZIP?
In my tests, yes. Brotli was 5% to 25% smaller on HTML, CSS and JavaScript. Very small files or files that are already compressed, such as JPEG images, gain little or nothing from either format.
Q3. Can I use Brotli and GZIP together?
Yes, and you should. The browser lists the formats it accepts, and the server picks the best one. Brotli goes to modern browsers over HTTPS, and GZIP covers everything else.
Q4. Does Cloudflare use Brotli?
Yes. Cloudflare enables Brotli on every site, and the old toggle was removed in 2024. It sends Brotli or GZIP based on the browser’s Accept-Encoding header.
Q5. Does Brotli compression help SEO?
Indirectly. Smaller files load faster, which helps page speed and Core Web Vitals. The bigger gain is having any compression at all, because Lighthouse flags uncompressed text files.
Q6. Should I compress images with Brotli or GZIP?
No. JPEG, PNG and WebP images are already compressed. Text compression adds CPU work for almost no saving. Compress HTML, CSS, JavaScript, JSON and SVG files only.
