What Is a CDN? Content Delivery Networks Explained
Quick answer
A CDN (content delivery network) is a network of servers in many locations that stores cached copies of your website's files, such as images, scripts and pages. Visitors are served from a nearby server instead of your main host, so pages usually load faster, your server handles less traffic, and your site copes better with spikes and attacks.
Why CDNs exist
Data takes time to travel. If your website is hosted on a single server in one country, a visitor on the other side of the world waits longer for every file than someone next door. A busy page can need dozens of files, so those delays add up.
A CDN solves this by keeping copies of your files on servers spread across many cities, often called edge servers or points of presence (PoPs). Each visitor is routed to a nearby one.
How a CDN works
- A visitor requests your page. DNS routes the request to the CDN rather than straight to your host.
- The nearest edge server checks its cache. If it has a fresh copy of the file (a cache hit), it sends it straight back.
- If not (a cache miss), the edge server fetches the file from your host, called the origin, sends it to the visitor and keeps a copy.
- Later visitors nearby get the cached copy, until it expires according to your cache settings.
Your host remains the source of truth. The CDN is a fast, distributed layer in front of it.
What a CDN does for your site
| Benefit | How it helps |
|---|---|
| Faster loading | Files travel a shorter distance; many CDNs also compress and optimise them |
| Less load on your host | Most requests for static files never reach your server |
| Handles traffic spikes | Cached content can be served even when traffic jumps suddenly |
| Better availability | Some CDNs can keep serving cached pages if the origin briefly goes down |
| Security | Many CDNs include DDoS protection, a web application firewall and HTTPS |
How much difference a CDN makes depends on where your visitors are, how heavy your pages are and how well your site can be cached. A local business whose visitors and host are in the same region may see a smaller gain than a site with a global audience.
What gets cached
- Static files such as images, CSS, JavaScript, fonts and videos. These are the easiest wins.
- Whole pages on static sites, such as those built with Astro, Hugo or other static site generators.
- Not usually personalised content, such as shopping carts, account pages or admin areas. These should bypass the cache.
Caching is controlled mostly by HTTP headers like Cache-Control sent by your server, plus rules you set in the CDN’s dashboard.
Do you need a CDN?
You might already have one. Many hosted website builders, e-commerce platforms and modern hosts for static and front-end sites serve every site through a built-in CDN.
You should consider adding one if:
- You host your own site, such as WordPress on a server or shared hosting.
- Your visitors are spread across several countries or continents.
- Your pages are image-heavy or slow to load.
- You’ve had problems with traffic spikes or attacks.
For a simple site on a platform that already includes one, there’s usually nothing to do.
How to set up a CDN
There are two common approaches.
Option 1: Full-site proxy via DNS
Services such as Cloudflare can sit in front of your whole site:
- Create an account with the CDN provider and add your domain.
- Review the imported DNS records, and make sure your website, email (MX) and verification records are all present.
- Change your domain’s nameservers at your registrar to the ones the provider gives you, or, with some providers, add a CNAME record instead.
- Choose your SSL setting so traffic is encrypted between visitors, the CDN and your host. See what an SSL certificate is.
- Test the site, then adjust caching rules for pages that shouldn’t be cached.
Option 2: CDN for static files only
Some setups only send images and other assets through a CDN, often on a subdomain such as cdn.example.com. WordPress caching plugins and many hosts offer this as a built-in option.
Things to watch out for
- Stale content. After updating your site, you may need to purge the CDN cache so visitors see the new version.
- Caching private pages. Make sure logged-in, cart and checkout pages aren’t cached and shown to other people.
- Email after a nameserver change. Moving DNS to a CDN provider means your MX records must move too.
- Double SSL settings. A mismatched SSL mode between the CDN and your host can cause redirect loops.
CDN vs. web hosting
A CDN doesn’t replace your host. You need a host to store and run your site, and a CDN can make that site faster and sturdier. To compare hosting options, read what web hosting is.
Frequently asked questions
Is a CDN the same as web hosting?
No. Your host stores the original copy of your site and runs it. A CDN sits in front of the host and serves cached copies. You still need hosting when you use a CDN.
Does a CDN help SEO?
Indirectly. A CDN can improve page speed, and Google uses page experience signals, including Core Web Vitals, as part of its ranking systems. Content and relevance matter far more.
Do website builders include a CDN?
Many hosted builders and platforms serve sites through a CDN automatically, so you may already have one without setting anything up. Check your platform's documentation.
Is a CDN free?
Some providers offer free plans that suit small sites. For example, Cloudflare lists a Free plan that includes its CDN, and paid plans from $20 a month billed annually (checked October 2026). Other paid plans usually charge by bandwidth, requests or features. Pricing varies widely, so compare based on your traffic.
Sources