Free auditStart free
GlossaryGlossary · Performance

CDN

A CDN is a group of servers in many locations that store copies of your content and serve it from the nearest one. What it caches, its risks, and how to measure it.

3 min
read
2
sources
Oct 24, 2026
updated
Scaplet Editorial Team
author
In one line

A CDN (content delivery network) is a group of servers distributed across multiple geographic locations that store duplicate copies of data. Requests are fulfilled by whichever servers are closest to the user, which can lower latency and lowers the request load on your own servers. CDNs are widely used for static assets such as stylesheets and JavaScript files.

30-second check

Is this costing your site traffic?

Four quick questions, then a straight answer.

1/4Have you checked your own site for this?
Summarize this page withChatGPTClaudePerplexityGoogleAI Mode
01Check it

How CDNs work

MDN defines a CDN as a group of servers distributed across multiple geographic locations that store duplicate copies of data. The servers fulfill requests based on which one is closest to the end user, which makes for fast service that is less affected by high traffic.

MDN says CDNs are used widely for delivering stylesheets and JavaScript files (static assets) of libraries like Bootstrap and jQuery, and that entire websites can be served from CDNs, particularly static websites made only of static HTML, CSS and JavaScript files.

Illustrative CDN request flow
1. A visitor in Japan requests https://example.com/image.jpg
2. DNS or routing sends the request to a nearby CDN server
3. Cache hit: the CDN serves its stored copy
4. Cache miss: the CDN fetches the file from your origin and stores it
5. Later visitors nearby get the stored copy
02Checklist

Common use cases for CDNs

First1
Stylesheets and JavaScript files
Next1
Library files such as Bootstrap or jQuery
Then1
Entire static websites made only of static HTML, CSS and JavaScript files
04Check it

CDN limitations and risks

MDN names three drawbacks. First, third-party dependency: if the CDN goes down, is blocked in a region or is permanently shut down, MDN says your website will malfunction. Second, security: attackers can compromise the CDN and serve malicious content to your users. Third, performance: MDN says a CDN may actually reduce performance, because connecting to a third-party site means more rounds of DNS lookup, content negotiation and so on.

MDN also says modern browsers do not share cache between different origins for the same resource, for privacy reasons, so the user has to download the same asset (for example jQuery) multiple times on different websites anyway. Test your own setup rather than assuming a CDN helps.

SRI on a CDN-hosted script
<script
  src="https://cdn.example.com/lib.js"
  integrity="sha384-REPLACE_WITH_REAL_HASH"
  crossorigin="anonymous"></script>

<!-- Generate the hash from the exact file: -->
<!-- cat lib.js | openssl dgst -sha384 -binary | openssl base64 -A -->
05How it works

Measuring CDN impact

  1. 1

    Record a baseline

    Before the change, record LCP and time to first byte (TTFB) with PageSpeed Insights or WebPageTest.

  2. 2

    Cache static assets

    Route images, stylesheets, scripts and fonts through the CDN and set Cache-Control headers that match how often each file changes.

  3. 3

    Confirm it is caching

    Run curl -sI https://example.com/image.jpg twice and compare the response headers, such as cache-control and age. Hit or miss headers differ by provider, so check your provider's docs.

  4. 4

    Test from other regions

    Run WebPageTest from locations far from your origin, and compare against the baseline.

  5. 5

    Watch field data

    Check the Core Web Vitals report in Search Console over the following weeks. Google's targets are LCP within 2.5 seconds, INP under 200 milliseconds and CLS under 0.1.

  6. 6

    Compare cost

    Check your provider's pricing against the improvement you measured.

Sources · 2

Every fact, linked and dated.

Official docs first. The date is when we last opened each page.
  • mozilla.org
  • google.com
  1. 01CDN (MDN glossary)developer.mozilla.org · checked 2026-10-24
  2. 02Understanding Core Web Vitals and Google search resultsdevelopers.google.com · checked 2026-10-24
Questions

Asked a lot.

3 questions people ask next, answered from the sources on this page.

01Do I need a CDN to have a fast website?

No. A CDN helps most when visitors are far from your origin or you serve many static files. If your audience sits near your server, measure first: MDN notes a CDN can add DNS lookups and overhead that offset the gain.

02What should I put on a CDN?

MDN's examples are stylesheets, JavaScript files and static websites made only of static HTML, CSS and JavaScript. Check your provider's docs before caching pages that differ per user.

03Does a CDN improve SEO?

Google's Core Web Vitals page doesn't mention CDNs. It says good Core Web Vitals, along with other page experience aspects, "aligns with what our core ranking systems seek to reward". If your slow loading came from distance to the origin, a CDN may help those metrics.

Free · 2 minutes

Know the term. Now check your site.

The free audit reads robots.txt, sitemaps, status codes, canonicals, redirects and structured data.

Free, no card60 secondsNobody will call you
  • 46 fixes shipped without a ticket Brightpipe
  • +212% organic clicks in 90 days Ledgerly