What is a CDN?
By Ash, Founder, HosteazePublished 2 min read
The short answer
A CDN (content delivery network) is a group of servers in many locations that keep copies of your website's files, such as images, stylesheets and scripts. Visitors get those files from the nearest server rather than your host, so pages load faster for distant visitors and your own server has less work to do.

Without a CDN, every visitor to your site fetches every file from one place: your hosting server. That's fine when your visitors are nearby. When someone in Lisbon or Sydney opens a page hosted in Manchester, each request makes a long round trip, and a page with 60 files makes a lot of them.
How does a CDN work?
- You connect your site to a CDN, usually by changing your domain's nameservers or adding a DNS record.
- A visitor requests your page and is routed to the CDN's nearest location, often called an edge server.
- If that edge server already holds a copy of the file, it sends it straight back. That's a cache hit.
- If it doesn't, it fetches the file from your hosting server (the "origin"), sends it on, and keeps a copy for the next visitor.
Cloudflare's own documentation gives the example of a visitor in Paris reaching a site hosted in Los Angeles: the first Parisian gets a copy fetched from LA, and the next ones get the copy stored in Paris.
What does a CDN store, and what doesn't it?
| Usually cached | Usually not cached |
|---|---|
| Images, video and fonts | Your HTML pages (unless you set a rule) |
| CSS stylesheets | Basket, checkout and account pages |
| JavaScript files | Anything that changes for each visitor |
| PDFs and downloads | Admin areas such as /wp-admin |
The left-hand column is where the speed comes from, because those files are the bulk of most pages. The right-hand column matters for shops and membership sites. Cache a basket page by mistake and one customer could see another's items, which is about as awkward as a support ticket gets.
What else does a CDN do?
Because a CDN sits between visitors and your server, it can do more than speed things up. Many CDNs, Cloudflare among them, also work as a reverse proxy: they hide your server's real IP address, soak up traffic floods such as DDoS attacks, and handle the SSL certificate encryption work so your server doesn't have to.
Do I need a CDN?
Here's our rule of thumb. If your visitors are mostly in one country and your server is in the same country, a CDN is helpful but optional, so fix images and caching first. If your visitors are spread across the UK, Europe or further, it's worth setting up, because the distance saving is real. And if you run a shop or busy blog with traffic spikes, set one up mainly to take load off your server.
Cloudflare, for one, has a free plan that includes its CDN. If your site still feels slow after adding one, the problem is probably closer to home. Our guides on why your WordPress site is slow and how to speed up WordPress cover the usual suspects.
Frequently asked questions
Is a CDN the same as web hosting?
No. Your host still runs your website and stores the original files. The CDN sits in front of it and hands out copies of files that don't change often, going back to your host whenever it needs a fresh copy.
Does a CDN help if all my customers are in the UK?
Less than you might think. If your server is already in the UK, the distance a UK visitor's request travels is short. A CDN can still take load off your server and absorb traffic spikes, but sorting out heavy images and plugins usually makes a bigger difference.
Will a CDN cache my WordPress pages?
Not by default with most CDNs. Cloudflare, for example, caches files such as images, CSS and JavaScript by file extension but does not cache HTML unless you add a rule. Pages that change per visitor, like a basket or account page, should never be cached.