Brotli Compresses Text Smaller at the Same Cpu Cost
I spent most of my early years running a small hosting outfit, and if there’s one thing I learned, it’s that people love to overcomplicate things that should be simple. I recently had a client come to me frantic because their site felt sluggish despite having a decent server, and we spent two hours digging through logs only to find they were still relying on outdated compression settings. When you start looking at the debate of gzip versus brotli compression, it’s easy to get lost in the academic whitepapers and benchmark charts that promise the moon. But in the real world, you aren’t looking for a PhD thesis; you’re just trying to figure out which one is going to shave a few milliseconds off your load time without spiking your CPU usage and crashing your site.
I’m not here to sell you on some shiny new miracle that requires a complete server overhaul. My goal is to cut through the marketing noise and give you the practical reality of how these two actually behave when they’re under load. I’ll show you where the real performance gains live and, more importantly, where the trade-offs are so you don’t end up with a faster site that’s too expensive to run.
gzip

Gzip is a standard compression tool that uses the DEFLATE algorithm to shrink the size of your text-based files before they leave the server. It works by finding repetitive patterns in your data and replacing them with much smaller tokens, which significantly reduces the amount of bandwidth required to serve a page. For years, it has been the industry default because it is incredibly lightweight and works on almost every web server configuration without a second thought.
I’ve spent enough nights troubleshooting slow-loading sites to know that while gzip isn’t a magic bullet, it’s the absolute bare minimum you should be running. If you haven’t configured it, you are essentially forcing your users to download massive, uncompressed files, which is just bad practice. It’s one of those boring, foundational settings that, when left unchecked, makes a perfectly fine server feel like it’s running on a dial-up connection from 1998.
brotli

Brotli is a more modern compression format developed by Google that uses a dictionary-based approach to achieve much higher compression ratios than older methods. By utilizing a pre-defined list of common words and patterns, it can squeeze your files down even further than traditional methods. The primary selling point is its ability to deliver smaller file sizes without sacrificing much in the way of CPU overhead, making it a superior choice for modern web traffic.
In my experience, switching to brotli is one of those small wins that actually moves the needle on your performance metrics. You can argue about the technical nuances of the algorithm all day, but the reality is that smaller payloads mean faster sites. When I’m consulting for clients who have outgrown basic shared hosting, getting their compression right is often the easiest way to shave precious milliseconds off their load times and keep their visitors from bouncing.
Compression Algorithm Comparison
| Feature | gzip | brotli |
|---|---|---|
| Primary Algorithm | DEFLATE | LZ77 + Huffman coding |
| Compression Ratio | Moderate | High (superior for text) |
| Compression Speed | Very Fast | Slower (especially at high levels) |
| Decompression Speed | Very Fast | Fast |
| Browser Support | Universal | Excellent (modern browsers) |
| Best For | General purpose/legacy | Web assets (CSS, JS, HTML) |
| Resource Usage | Low | Moderate to High (during compression) |
Why Payload Size Reduction Is Your Most Boring Lever

Look, I’m not going to pretend that shaving a few kilobytes off a CSS file is going to revolutionize your business model. It won’t. But when you’re dealing with thousands of concurrent users or clients on shaky mobile connections, payload size reduction is the most boring lever you have, and it’s often the most effective. In the debate between gzip and Brotli, this is where the math actually meets the real world.
When you run the numbers, Brotli almost always wins on raw compression ratios, especially for text-based assets like HTML and JS. It’s more efficient at finding patterns, which means smaller files hitting the wire. Gzip is the old reliable—it’s fast and it’s everywhere—but it just doesn’t pack the same density.
The practical implication is simple: Brotli gets your site to a “ready” state faster by sending less data. While the difference per request might feel negligible, the cumulative effect on bandwidth costs and page load times is what keeps your server from sweating during a traffic spike.
For pure payload reduction, Brotli takes the win.
Measuring Http Compression Performance Without the Marketing Hype
Look, I’ve seen too many people stare at Lighthouse scores like they’re gospel truth. A high score looks great on a slide deck, but it doesn’t tell you how your server actually behaves when it’s under load. When you’re deciding between gzip and Brotli, measuring performance isn’t about chasing a single number; it’s about understanding the trade-off between file size and CPU cycles.
If you run a benchmark using only file size, Brotli wins every single time. It’s objectively better at squeezing those extra bytes out of your CSS and JS. But if you’re measuring real-world server strain, the picture changes. Gzip is incredibly “cheap” to compute. Brotli, especially at higher compression levels, can be a resource hog that spikes your CPU usage just to save a few kilobytes that your user won’t even notice on a decent 4G connection.
For this specific category, the winner depends on your hardware, but if we are talking about pure efficiency without the fluff, gzip remains the safer bet for high-traffic environments where CPU overhead is a real concern.
The bottom line
Don’t get caught up in the benchmarks; if your server supports Brotli, turn it on for static assets and call it a day.
Compression isn’t a magic bullet for a bloated database or unoptimized images, so don’t use it as an excuse for bad site hygiene.
Always test your configuration in a staging environment first, because a misconfigured compression module is just another way to take your own site offline.
The Bottom Line
Look, we aren’t here to reinvent the wheel. If you are running a modern stack and your server has the overhead to handle it, switching to Brotli is a no-brainer for reducing payload sizes. It beats gzip on almost every metric that actually matters for site speed, especially when you’re dealing with text-heavy assets like CSS and JavaScript. But don’t go chasing benchmarks if you’re running on a resource-constrained legacy VPS where every CPU cycle counts. If your priority is simplicity and zero friction, sticking with gzip is a perfectly valid way to keep things running without adding complexity to your configuration files.
At the end of the day, my advice is to stop overthinking the “perfect” setup and just pick a direction. Whether you go with the battle-tested reliability of gzip or the slightly better compression of Brotli, the most important thing is that you actually enable one of them. A site with no compression is a site that is actively wasting its users’ time and your bandwidth. Get your compression settings right, check your logs, and then get back to the real work of keeping your services online. The goal isn’t to have the most impressive tech stack in the room; it’s to have a site that actually stays up and loads fast.
Frequently Asked Questions
Do I actually need to change my Nginx or Apache config, or will my CDN handle this automatically?
It depends on where your “edge” actually sits. If you’re using a CDN like Cloudflare, they usually handle the heavy lifting at their layer, meaning your origin server might still be sending gzip while the user gets Brotli. It’s efficient, but it can make your local debugging a headache. If you aren’t using a CDN, or if you want total control over the compression happening at your origin, you’ll need to touch your Nginx or Apache configs. Don’t assume it’s automatic; verify it.
Is the extra CPU hit from Brotli actually going to slow down my server response times during a traffic spike?
Here’s the reality: Brotli is more computationally expensive than gzip, especially at higher compression levels. If you’re running a tight server and a massive traffic spike hits, that extra CPU overhead is real. However, if you’re serving static assets, you shouldn’t even be compressing them on the fly—pre-compress them. If you’re doing dynamic compression, just don’t crank the Brotli level to 11. Keep it moderate, and the smaller payload usually wins the race.
Will switching to Brotli mess up my existing caching setup or cause issues with older browsers?
You won’t break your site by switching, but you need to understand how the negotiation works. Brotli isn’t a replacement for gzip; it’s an alternative. Modern browsers will ask for Brotli via the `Accept-Encoding` header, and if they don’t support it, the server just falls back to gzip like nothing happened. As for caching, most modern CDNs and Nginx setups handle this gracefully. Just don’t disable gzip entirely until you’ve verified your fallback logic.