SEO

Compression

Also called Gzip, Brotli, HTTP compression

Packing text responses on the server so they travel smaller, then unpacking them again in the browser.

Quick facts: Compression

Category
SEO
Also called
Gzip, Brotli, HTTP compression
Level
Beginner
Affects
Transfer size, load time on mobile data, hosting bandwidth
Where to see it
Chrome DevTools Network panel, PageSpeed Insights, hosting or CDN settings
In this article4
  1. How compression works
  2. Why compression matters
  3. Where compression goes wrong
  4. How to check and fix it

How compression works

Text repeats itself. A stylesheet names the same properties over and over, and an HTML page reuses the same tags on every line, so a server can describe the file far more briefly than the file describes itself. Compression does exactly that: the server packs a text response before sending it, the browser unpacks it on arrival, and the page is identical either way.

The browser announces which methods it understands, the server picks one and names it in the response headers. Gzip is the long-standing option that everything supports. Brotli is the newer one and, for text, generally produces a smaller result, which is why hosts and content delivery networks reach for it whenever the visitor’s browser allows.

Why compression matters

It reduces what actually travels, so it helps most where the connection is weakest. On mobile data, which is how most people in Nepal browse, fewer bytes means both a faster page and a smaller bill for the visitor. It also speeds up the files that hold everything else up: a render-blocking stylesheet arriving sooner brings the first paint forward with it.

It is one of the few improvements that costs nothing to maintain. Once it is enabled at the server or the delivery network it applies to everything you publish from then on, with no per-page work and no design consequences.

Where compression goes wrong

The most common problem is that it is simply off, or on for some file types and not others. Managed hosting and delivery networks usually enable it by default; budget shared hosting sometimes does not, and a misconfigured server can compress HTML while serving stylesheets and scripts raw.

The opposite mistake is compressing what cannot shrink. Images, video, audio and archive files are already packed, so running them through again spends processor time for nothing and can even make the response marginally larger. Those formats need their own treatment: correct sizing, modern image formats and sensible quality settings. And compression is never a substitute for sending less — packing a large unused script tightly still ships a large unused script.

How to check and fix it

Open your site in Chrome, look at the network panel and inspect the response headers of the HTML document and your main stylesheet and script. A content-encoding header naming Brotli or Gzip means it is working; no such header means it is not. PageSpeed Insights will also flag uncompressed text resources directly.

If it is off, the fix is usually a setting rather than code: enable it in the hosting control panel, turn it on at the content delivery network, or ask the host to do it. Make sure the list of compressed types covers HTML, CSS, JavaScript, SVG and JSON, and leave images and video out of it. Confirm the headers again from outside your own office, since a proxy on your network can quietly change what you see. If everything is compressed and pages are still heavy, the next step is removing code rather than packing it, which is where page speed optimisation starts.

Do and do not

Do

  • Check the content-encoding header on your own pages
  • Compress HTML, CSS, JavaScript, SVG and JSON
  • Let the delivery network or host handle it if offered

Do not

  • Re-compress images, video or files already packed
  • Assume cheap shared hosting has it switched on
  • Rely on it instead of removing unused code

Questions people ask about this

How do I know whether compression is enabled?

Open the page in Chrome, switch to the network panel, reload, and click the HTML document. In the response headers, look for content-encoding. If it names Brotli or Gzip, the response was compressed. If the header is missing, it was not. Repeat the check on your main stylesheet and script, because servers are often configured inconsistently.

Should I use Brotli or Gzip?

Brotli where it is available, with Gzip as the fallback. For text files Brotli generally produces a smaller result, and browsers that do not support it simply negotiate Gzip instead, so nothing breaks. Most managed hosts and delivery networks handle that negotiation automatically, which means the practical decision is usually just to leave it switched on.

Does compression slow the server down?

Slightly, because packing a response costs a moment of processor time, but it is nearly always a good trade against the time saved in transfer. Servers and delivery networks also store compressed copies of static files, so the work is done once rather than on every request. On a normal site you will not notice the difference.

Related terms

Found this useful?

Share it, or ask an AI to summarise it

Back to the glossary

Knowing the term is the easy part

Applying it to your own site and budget is the work. Book a call and I will tell you what actually applies to you.