Glossary
technical

Compression

Definition

Reducing file sizes by encoding data more efficiently. Servers compress files before sending them, and browsers decompress them automatically.

What is Compression?

Compression reduces file sizes by encoding data more efficiently. When you request a web page, the server compresses files before sending them. Your browser automatically decompresses them. You get the same content with less data transferred.

Text files (HTML, CSS, JavaScript) compress extremely well – often by 70-90%.

How Compression Works

Compression algorithms find patterns and redundancy in data. Instead of storing repeated patterns multiple times, they store them once and reference them.

Simple Example

Original: "the cat sat on the mat" Compressed: "1 cat sat on 1 mat" (where 1 = "the ")

Real compression is far more sophisticated, but the principle is the same.

Types of Web Compression

Gzip

The standard for years. Compresses text files by 70-90%. Supported everywhere.

Brotli

Newer, more efficient algorithm by Google. 15-25% better compression than Gzip. Widely supported in modern browsers.

Image Compression

Separate from text compression. Reduces image file sizes while maintaining visual quality.

Compression Impact

File Type Original Gzip Brotli
HTML 100KB 20KB 17KB
CSS 200KB 35KB 28KB
JavaScript 500KB 120KB 95KB

Enabling Compression

Most Hosts Enable It

Quality hosting providers enable Gzip by default. Check with Google PageSpeed Insights – it will flag missing compression.

Server Configuration

If your host doesn't enable it automatically:

  • Apache – mod_deflate module
  • Nginx – gzip directive
  • CDNs – usually automatic

No User Action Required

Browsers handle decompression automatically. Users don't need to do anything – they just get faster load times.

Compression vs Minification

Both reduce file size, but differently:

  • Minification – removes unnecessary characters from code
  • Compression – encodes the data more efficiently

Use both for maximum benefit. Minify first, then compress.

Want to Learn More?

Check out our in-depth guides on web design, SEO, and digital marketing.