Skip to main content
SEO & Performance

How to Speed Up Your Website with Compression, Caching and a CDN

By Byteary Team · Sep 21, 2026 · 4 min read

How to Speed Up Your Website with Compression, Caching and a CDN

When a site feels slow, the first instinct is to blame the code or the hosting plan. In practice, a large share of slow sites are simply missing three pieces of server configuration that take minutes to fix: compression, caching and a CDN. Check those first.

Diagram showing how compression, browser caching and a CDN each reduce page load time
Compression makes each file smaller, caching avoids downloading it again, and a CDN shortens the distance it travels.

1. Compression: send fewer bytes

HTML, CSS, JavaScript, JSON and SVG are text, and text compresses extremely well - often to a quarter of its size or less. The browser announces which formats it understands, and the server compresses the response before sending it.

  • GZIP - supported everywhere; the baseline.
  • Brotli - newer, and usually 15-25% smaller than GZIP for text. Supported by all modern browsers over HTTPS.

Run your domain through the Compression Summary to see both at once, or use the GZIP Checker and Brotli Checker individually. You are looking for Content-Encoding: br or gzip in the response.

If compression is off:

# Nginx
gzip on;
gzip_types text/css application/javascript application/json image/svg+xml;

# Apache (.htaccess, needs mod_deflate)
AddOutputFilterByType DEFLATE text/html text/css application/javascript application/json

Do not bother compressing JPG, PNG, WebP or video - they are already compressed and gain nothing.

2. Caching: do not download the same file twice

Your logo, stylesheet and scripts are the same on every page. Without caching headers, the browser may check or re-download them on each visit. The Cache-Control header tells it how long it may reuse a file.

ContentSuggested header
Versioned CSS/JS (app.css?v=123, app.4f9c.js)Cache-Control: public, max-age=31536000, immutable
Images and fontsCache-Control: public, max-age=2592000 (30 days) or longer
HTML pagesCache-Control: no-cache or a short max-age

The long cache on CSS and JS is safe only because the file name or version changes on every deploy - that is what makes the browser fetch the new one. HTML stays short so visitors see updates immediately.

Check any URL with the Cache Headers Checker. Test a stylesheet or image URL as well as the page itself; they often have different rules. An Age header in the result means the response came from a CDN or proxy cache.

3. A CDN: shorten the distance

If your server is in Mumbai and your visitor is in London, every request crosses the world. A CDN keeps copies of your static files (and sometimes whole pages) on servers near each visitor. Many also add Brotli, HTTP/2 and HTTP/3, and absorb traffic spikes.

The CDN Detection tool recognises Cloudflare, CloudFront, BunnyCDN, Fastly, Akamai, Google Cloud CDN and Azure CDN from their response headers. It is a quick way to confirm a new CDN is actually in the path.

Two quick extras

Then look at the page itself

Once the server side is sorted, the biggest remaining wins are usually on the page:

For an overall picture, the Performance Health Score combines several of these checks into one score.

Measure before and after

Run PageSpeed Insights before you change anything and again afterwards. It reports Google's Core Web Vitals from real Chrome users where enough data exists, which is what matters for both visitors and search. Google explains the metrics on web.dev.

Fast pages are pointless if they are served insecurely - pair this with our guide to checking your SSL certificate.

Comments (0)

Leave a Comment

CAPTCHA image - enter the characters shown

Your comment will appear after it's been reviewed.

Related Posts