Free, independent guides since 2010

Hosting & domains

What is a CDN and does your website need one?

How a content delivery network works, what it does for speed, security and bandwidth, the difference between caching and hosting on a CDN, and when a small site benefits.

<guide section="Hosting & domains" type="article" read="1 min"/>

A content delivery network (CDN) is a network of servers spread around the world. Instead of every visitor downloading your images and pages from one server in one data centre, they get them from a nearby CDN location. The result: faster pages and less load on your server. It is one of the most effective items on our website speed checklist.

How it works

  1. Your domain points to the CDN (via nameservers or a DNS record).
  2. The first visitor near a CDN location gets the file from your server, and the CDN keeps a copy.
  3. Next visitors in that region get the copy directly from the CDN.
  4. Copies expire based on your cache settings, or when you purge them.

Benefits

  • Speed: shorter distances and modern protocols. See Core Web Vitals.
  • Stability: traffic peaks hit the CDN, not your server.
  • Security: many CDNs filter attacks and offer a web application firewall. See DDoS protection.
  • Lower bandwidth on your hosting plan (see bandwidth myths).

Caching basics

ContentTypical cache time
Images, fonts, CSS and JS with versioned namesWeeks to a year
HTML of static pagesMinutes to hours, or purge on publish
Cart, account, admin pagesNever cache

Frequently asked questions

Does a CDN help if all my visitors are in Belgium?

Less for distance, but a CDN still offloads your server, adds HTTP/3 and compression, absorbs traffic spikes and filters attacks.

Can a CDN break my website?

Wrong caching settings can show outdated pages or cache personal content like shopping carts. Exclude logged-in and dynamic pages from caching, and know how to purge the cache.