A CDN, short for content delivery network, is a network of servers spread across many locations worldwide that store copies of your website files and serve them from whichever server is closest to each visitor. Instead of every request traveling all the way to your origin server, a nearby edge server answers it, so the data covers a much shorter distance and arrives faster. That distributed-caching idea is the whole point. CDNs matter because distance and load are major causes of slow sites, and a CDN attacks both. This explainer covers how a CDN works, a concrete example, and when you actually need one.
How a CDN works
Your website has an origin server where the real files live. A CDN places copies, or cached versions, on edge servers in data centers around the world. When a visitor requests an image or a script, the request is routed to the nearest edge server. If that server already has a fresh copy, it serves it immediately — no trip to the origin. If not, it fetches the file from the origin once, serves it, and stores it for the next visitor in that region.
This is caching applied to geography. If the underlying idea is new to you, how a cache works explains the same store-a-fast-copy principle that a CDN scales across continents. The benefit is twofold: shorter distance means lower latency, and spreading requests across many edge servers takes load off your origin and helps absorb traffic spikes and many denial-of-service attempts.
What a CDN does and does not speed up
| Content type |
CDN helps? |
Why |
| Images and video |
Yes, a lot |
Large, static, reused by many users |
| CSS and JavaScript |
Yes |
Static files cached at the edge |
| Static HTML pages |
Yes |
Same page served to everyone |
| Personalized pages |
Less |
Differs per user, harder to cache |
| Live database writes |
No |
Dynamic, must reach the origin |
The pattern: a CDN shines on static content reused across users and does little for dynamic, per-request data that must hit your server anyway.
A concrete example
Suppose your site is hosted in one country and a visitor loads it from the other side of the world. Without a CDN, every image and script travels that full distance, and the page feels sluggish. With a CDN, those static files are already cached on an edge server in the visitor region, so they load from nearby in a fraction of the time. Meanwhile your origin server only handled the dynamic parts, so it stays light even when traffic surges.
Common misconceptions
- A CDN replaces your hosting. It does not. You still need an origin server; the CDN caches copies of its static files closer to users.
- A CDN speeds up everything. It mainly helps static, reusable content. Dynamic, personalized responses still reach the origin.
- Cached files always stay current. They do not, unless you set expiry rules or purge the cache after a change, or users may see stale files.
- Every site needs one. A small app with only local users sees little benefit; distance is not the bottleneck, so the setup adds cost for little gain.
FAQ
What is a CDN in simple terms?
A network of servers in many locations that keep copies of your files and serve each visitor from the nearest one, so content loads faster and your origin server is relieved.
Does a CDN replace web hosting?
No. You still need a host for your origin server. The CDN sits in front of it, caching and serving static files from the edge.
Will a CDN speed up a dynamic site?
It speeds up the static parts — images, scripts, styles — which are usually most of the load. Truly dynamic, per-user responses still have to reach your server.
Do I need a CDN for a small site?
If your audience is global or your site is media-heavy, yes. For a small app with mostly local users, the benefit is limited and may not justify the setup.
Where to go next
Learn what a cache is, understand what a load balancer does, and see what DNS is and how it routes requests.