Glossary · Performance

Compression Ratio

Compression ratio compares a file's original size with its compressed size, showing how much a method like gzip or Brotli reduces transferred bytes.

Updated October 6, 2026

Compression ratio expresses how much smaller data becomes after compression. It is written either as original size divided by compressed size (for example 4:1) or as a percentage saved ((original - compressed) / original).

Why it matters

The ratio tells you whether compression is worth enabling for a file type and whether a stronger setting pays off. Repetitive text such as HTML, CSS, JSON and JavaScript often compresses well, while already-compressed formats such as JPEG, MP4 and ZIP barely change. Ratios also depend on minification, since minified files have less redundancy but fewer total bytes.

Example

bundle.js   original 600,000 bytes
gzip        150,000 bytes   -> 4.0:1, saved 75%
brotli      128,000 bytes   -> 4.7:1, saved 78.7%

Check it on a live site by comparing sizes:

curl -s https://example.com/app.js | wc -c
curl -s -H 'Accept-Encoding: gzip' https://example.com/app.js | wc -c

Common mistakes

  • Chasing a higher ratio at the expense of CPU time and TTFB.
  • Compressing small files under roughly 1 KB, where headers and overhead outweigh savings.
  • Comparing ratios across different content types.
  • Forgetting that decompression still costs the client time.

Get notified when this term updates

Plus occasional practical tips on uptime and monitoring, nothing else. Unsubscribe anytime.

This page is general information written by our editorial team and updated when documentation changes. Servers and providers differ, so test changes safely first. See our editorial policy and disclaimer.