Glossary / gzip / Brotli
What is gzip and Brotli compression
gzip and Brotli are compression methods a web server uses to shrink text files (HTML, CSS, JS) before sending them to the browser. The browser receives the compressed file and unpacks it on the fly. This noticeably cuts the amount of data and speeds up page loading.
Check your site
When the browser makes a request, it announces which compression methods it supports (the Accept-Encoding header). The server compresses the response and marks it with Content-Encoding: gzip or br. Text files compress very well, often by 3 to 4 times.
gzip is old and universal, supported everywhere. Brotli is newer, from Google, and usually compresses even tighter, especially at higher levels. Modern servers often offer both, and the browser picks Brotli when it can.
Compression only makes sense for text. Images, video, and archives are already compressed, so gzip and Brotli are not applied to them - it would only waste server effort.
Example
content-encoding: br
Common mistakes
- Thinking compression harms quality, when it is lossless and the file unpacks exactly as it was.
- Compressing images and video again, when they are already compressed, so it gains nothing and burns CPU.
- Assuming Brotli is always better, when on the fly for dynamic content a high Brotli level can be slower than gzip.
- Forgetting to enable compression on the server and serving pages at full size.
Related terms
Found problems?
Slow hosting, SSL trouble or frequent downtime? Move to TomisHost: fast hosting with free SSL, daily backups and free migration help.
TomisHost hosting