4 min read3 sourcesUpdated

What Is a CDN and Why Do Websites Use One?

What a content delivery network is, how it caches copies near you, and why it makes sites faster.

TL;DR

  • A CDN (content delivery network) is a group of servers spread across many places that keep copies of a website's files, so each visitor gets them from a server close by [1].
  • Shorter distance means lower delay, so pages load faster.
  • It also takes load off the site's own server and helps absorb traffic spikes.
  • A CDN adds a third-party dependency, so it is a trade-off, not magic.

How a CDN works #

Every website has an origin server, the machine where its files really live. If that server is in one country and you are in another, every image and script has to travel a long way. A CDN fixes this by placing many edge servers around the world, closer to ordinary users than the origin is [1].

Think of a book publisher with one warehouse. Shipping every order from that warehouse is slow. A CDN is like stocking copies in shops in every city: you buy from the shop down the road, and the warehouse only restocks when a shop runs out.

Two rows comparing a visitor reaching a distant origin server directly with a visitor reaching a nearby CDN edge server that holds a cached copy
Without a CDN every request travels to the origin. With a CDN most requests are answered by a nearby edge server. (tap or click the image to open it full size)

The steps look like this:

  1. You ask for a page or image.
  2. The request is sent to a nearby edge server of the CDN [2].
  3. If the edge server already has a cached (saved) copy, it replies straight away. This is a cache hit.
  4. If not, it fetches the file from the origin once, keeps a copy, and sends it to you. The next visitor nearby gets the cached copy.

Why websites use a CDN #

BenefitWhat it means
Faster loadingData travels a shorter distance, so there is less delay (latency) [1][2]
Less load on the originFewer requests reach the site's own server, which can lower bandwidth costs [1]
Handling traffic spikesMany edge servers share the work during a rush of visitors [1]
Smoother video and downloadsLarge files are served from close to the viewer [1]
Extra protectionSpreading traffic across many locations is also one way to ride out some floods of junk traffic [3]

CDNs are most useful for static files that are the same for everyone: images, stylesheets, scripts and video. Some CDNs can also speed up live or personalised content, but that is harder than caching a picture [1].

Downsides of using a CDN #

  • Dependency. If the CDN has an outage, is blocked in a region, or shuts down, the site can break [2].
  • Extra risk. A compromised CDN could serve harmful files. Browser features such as Subresource Integrity check that a file has not been changed [2].
  • Not always faster. Connecting to another host adds a lookup and connection step, and browsers no longer share caches between sites, so a shared library may still be downloaded again [2].

FAQ #

Do small websites need a CDN? #

Not always. A small site with local visitors may be fast enough without one. A CDN matters more when visitors are spread across the world or the site serves lots of images and video.

Does a CDN hide my website's real server? #

Visitors talk to the CDN's servers instead of the origin, so the origin is not what they connect to. That is not the same as being secure, and the origin still needs its own protection.

Is a CDN the same as web hosting? #

No. Hosting stores the original site. A CDN keeps extra copies of parts of it closer to visitors.

Does a CDN help with SEO? #

Faster pages give visitors a better experience, and speed is one of several things that can help a site's search performance. A CDN alone does not guarantee better rankings.

Sources #

All sources accessed 2026-10-27.

  1. What is a content delivery network (CDN)? IBM. https://www.ibm.com/think/topics/content-delivery-networks
  2. CDN. MDN Web Docs Glossary. https://developer.mozilla.org/en-US/docs/Glossary/CDN
  3. Defending against distributed denial of service (DDoS) attacks (ITSM.80.110). Canadian Centre for Cyber Security. https://cyber.gc.ca/en/guidance/defending-against-distributed-denial-service-ddos-attacks-itsm80110