Contents
Web text files are full of repetition: the same tags and function names appear hundreds of times, and compression exploits that. Visitors don’t have to do anything; it’s an automatic negotiation between browser and server through HTTP headers.
How it works
- The browser sends
Accept-Encoding: gzip, deflate, brwith its request. - The server picks a method both sides support and compresses the file.
- It replies with
Content-Encoding: brorgzipand the compressed file. - The browser decompresses it and renders the page.
Example: check your site
curl -sI -H 'Accept-Encoding: br, gzip' https://example.com | grep -i content-encoding
# content-encoding: br
If nothing prints, the file is sent uncompressed. You can also compare transferred size with actual size in the Network tab of your browser’s developer tools.
Comparison
| Gzip | Brotli | |
|---|---|---|
| Introduced | 1990s | 2015, by Google |
| Compression ratio | Good | Slightly better for text |
| Support | Every browser and tool | Modern browsers over HTTPS |
| Speed | Fast to compress | Slower at high levels, so static files are pre-compressed |
What not to compress
- Images, video and WOFF2 fonts are already compressed; doing it again wastes CPU for no gain. To shrink them, see the image optimisation guide.
- Very small files, where the saving isn’t worth it.
Common problems
- Double compression: a WordPress plugin compresses and the server compresses again, producing garbled characters or a blank page. Compress in one place only.
- A speed test says compression is off: it may be flagging a file from an external domain you don’t control, such as an ad script or web fonts.
- Compression doesn’t fix a slow server: it shortens transfer time, while the time to generate the page shows up in TTFB.
On ArabyHost
The LiteSpeed web server that ArabyHost runs supports both Gzip and Brotli, and on WordPress sites the LiteSpeed Cache plugin works directly with the server, so you usually don’t need a separate compression plugin that could cause double compression. Use the check above to confirm the result on your own site, and read the website speed guide for steps that improve your Core Web Vitals.
FAQ
Do I need a compression plugin in WordPress?
Usually not, if the web server already compresses files. Check first with developer tools or curl; if `content-encoding` shows up, skip the plugin, since it can cause double compression.
Which is better, Gzip or Brotli?
Brotli produces slightly smaller text files and the browser uses it automatically when both sides support it. Gzip still matters for older tools and browsers, so servers enable both.
Does Gzip help with images?
No. JPEG, PNG and WebP are already compressed, and compressing them again barely changes their size. To shrink images, change their format, dimensions or quality.