Learning objectives
After reading this article you will be able to:
- Understand what makes up a CDN bill: traffic, requests and origin
- Estimate your site's monthly cost with each provider's current price table
- Spot the hidden costs: region, cache misses, add-ons and currency
"How much does a CDN cost?" has two true answers at once: nothing, and a lot. A blog with a few hundred visits a day fits inside the no-fee tier of several providers. A video site with an audience across a whole continent can run a bill of hundreds of dollars a month. What separates the two is not the CDN brand but the volume and the region of the traffic.
To estimate your bill, you need to know what it is made of, apply each provider's current prices (price tables change, so always check the official page) and look for the costs nobody lists on the first pricing page. If you are still deciding whether you need one, read does a small website need a CDN? first.
What makes up the cost of a CDN?#
A CDN keeps copies of your files on servers around the world and serves each visitor from the nearest one. The bill follows that work:
- Traffic delivered (egress to the internet). The main item: every GB sent to visitors, priced differently per region.
- Requests. Some providers charge per batch of 10,000 HTTP or HTTPS requests. Sites with many small files feel this one.
- Cache fill. Traffic from your origin to the CDN when a file is not cached yet. Some providers charge for it, others do not.
- Origin egress. This one is charged by your hosting or storage provider, not the CDN. See egress fees.
- Add-ons. WAF, image optimization, real-time logs, cache invalidation, custom certificates.
There are two pricing models. With pay-as-you-go, you pay for every GB and every request. With a flat plan, you pay a monthly fee with an allowance of traffic and requests.
How much do the main CDNs cost?#
The pricing models of the best-known CDNs are below. The amounts change often, so check each provider's pricing page (listed in this guide's sources):
| Provider | Model | How it charges |
|---|---|---|
| Cloudflare | Flat plan per domain | An entry tier called Free, with no monthly fee, and paid plans (Pro, Business) with a fixed monthly fee and an annual discount. The plans page lists no per-GB transfer price |
| Amazon CloudFront | Flat plan | Monthly plans (from Free to Premium) with an allowance of GB and requests, and no overage charges |
| Amazon CloudFront | Pay-as-you-go | A monthly allowance at no cost; then a per-GB price that varies by region and drops in volume tiers, plus a fee per 10,000 HTTPS requests |
| Google Cloud CDN | Pay-as-you-go | A per-GiB price by region and volume tier, plus cache fill and cache lookups billed per 10,000 |
On CloudFront's flat plans, the allowance decides which plan fits you.
How do you estimate your site's cost?#
The pay-as-you-go formula is:
cost = GB delivered × price/GB for the region
+ (requests ÷ 10,000) × price per 10,000
+ GB fetched from origin × (cache fill + origin egress)The last term depends on the cache hit ratio: if 90% of responses come from cache, only 10% of the traffic goes back to the origin. To try scenarios, use this Node.js script:
// Monthly estimate for a pay-as-you-go CDN (values in US$)
const usage = {
gbDelivered: 3000, // total traffic served to visitors
requests: 30_000_000,
hitRatio: 0.9, // share served from cache (cache hit ratio)
};
const price = {
perGB: 0.05, // price per GB in your visitors' region (hypothetical value)
per10kRequests: 0, // some providers do not charge for requests
originEgressPerGB: 0, // what your origin charges to send data to the CDN
};
const delivery = usage.gbDelivered * price.perGB;
const requests = (usage.requests / 10_000) * price.per10kRequests;
const origin = usage.gbDelivered * (1 - usage.hitRatio) * price.originEgressPerGB;
console.log({ delivery, requests, origin, total: delivery + requests + origin });Save it as cdn.mjs, run it with node cdn.mjs and swap in your site's numbers. Your real volume shows up in your logs or in your host's analytics.
What does it cost in practice, by site size?#
The numbers in this section and in the script above are hypothetical, chosen to keep the math easy. They are not any provider's prices; real prices are on the official pricing pages listed in the sources. Swap in the current price table of the provider you are evaluating.
Hypothetical example, small site: 50 GB and 1 million requests a month, audience in Brazil. On a no-fee plan, or inside the free allowance of a pay-as-you-go plan, this load usually costs nothing. On a pay-as-you-go provider with no allowance, assuming $0.05 per GB in South America, it would be 50 × $0.05 = $2.50. The CDN barely registers.
Hypothetical example, medium site: 3 TB (about 3,000 GB) and 30 million requests, audience in Brazil.
- Pay-as-you-go with request fees: assuming $0.10 per GB and $0.01 per 10,000 requests, that is 3,000 × $0.10 = $300 of traffic plus 3,000 × $0.01 = $30 of requests. Around $330, before any free allowance.
- Pay-as-you-go without request fees: assuming $0.05 per GB, 3,000 × $0.05 = $150. If the same provider charged $0.02 per GB in Europe, the same audience there would cost $60.
- With cache fill: at a 90% hit ratio, only 300 GB go back to the origin. Assuming $0.01 per GB of cache fill, that adds $3 to the bill.
- Flat plan: the plan's monthly fee, as long as 3 TB and 30 million requests fit its allowance and terms.
The same load can range from tens to hundreds of dollars. Where your visitors are changes the bill as much as which provider you pick.
What are the hidden costs?#
- Visitor region. South America, Africa and the Middle East usually cost more per GB than Europe and North America, and the gap runs from a few tens of percent to several times the price, depending on the provider. If your audience is there, the first row of the price table is not your reference.
- Cache misses. Each miss fetches the file from the origin and can trigger cache fill at the CDN and egress at your host. On Google Cloud CDN, misses also add load balancer data processing charges. A badly set Cache-Control multiplies this cost.
- Requests for small files. A site with millions of icons and API calls can spend more on requests than on GB.
- Invalidation. Some providers, such as CloudFront, include a monthly quota of invalidation paths and charge per path above it. Deploys that purge the whole cache several times a day make this add up.
- Add-ons. Real-time logs, WAF and image optimization are usually billed separately.
- Currency and taxes. Almost every CDN bills in US dollars. If you pay in another currency, exchange rates and card fees change the real amount.
- Minimums and allowances. A monthly minimum, or an allowance that runs out mid-month, changes the real cost for low-traffic sites.
How do you lower your CDN bill?#
- Raise the hit ratio. Use hashed file names and
Cache-Control: public, max-age=31536000, immutablefor assets that never change. - Compress and optimize. WebP or AVIF images and Brotli or gzip text cut the GB delivered, which is the most expensive item.
- Invalidate only what changed. With versioned names, you rarely need to invalidate at all.
- Choose by your audience's region. Compare the per-GB price where your visitors actually are, not the headline price.
- Check what is already included. Many hosts already put a CDN in front of your app. Paying for another one on top only pays off if a specific feature is missing.
How to do this on Square Cloud#
On Square Cloud, the CDN does not show up as a separate line on the bill. Every plan includes a global CDN, unlimited traffic with no charge per bandwidth or per request (under the fair use policy), WAF, L3/L4/L7 DDoS protection and automatic TLS. The network is an Anycast CDN built on Cloudflare, with more than 200 points of presence, HTTP/3 and WebSockets.
Plans start with Hobby, from R$12.49 a month, billed in Brazilian reais by Pix or card. Every web application gets a *.squareweb.app subdomain with HTTPS; custom domains and load balancing, which also has no per-request charge, start on Standard, from R$44.99 a month.
The CDN caches responses and respects your application's Cache-Control, so setting those headers is still up to you: they tell browsers and the CDN how long to keep each response. See the details on the network and CDN page.
Network
Custom domains, automatic TLS and a global CDN for your app
FAQs
Is there a CDN with no cost?
Yes. Cloudflare's entry tier, called Free, has no monthly fee, and Amazon CloudFront has a Free flat-rate plan with a monthly allowance of data transfer and requests. Check the current limits and terms of each one.
Why does a CDN charge more for South America?
Bandwidth and network transit costs vary by region, and providers pass that on in their price tables. With several of them, a GB delivered in South America costs much more than in Europe and North America, sometimes several times as much.
Does the CDN also charge for traffic from my origin?
Some charge for cache fill, and your hosting provider may charge for data leaving the origin toward the CDN. The higher your cache hit ratio, the smaller that part of the bill.
Flat plan or pay per GB: which is cheaper?
For small traffic, pay-as-you-go usually lands close to zero. For large or unpredictable traffic, a flat plan gives you predictability. Run the numbers with your real volume from the last few months.
More in Networking and domains
See all 27 articles- What is a load balancer and how does it work?A load balancer spreads incoming requests across several servers. Learn how it works, the main algorithms, layer 4 vs 7, and a working nginx example.
- DNS records explained: A, CNAME, MX, TXTDNS records are the instructions in a zone that tell the internet where a name points. Learn A, AAAA, CNAME, MX, TXT, NS and CAA with examples and dig commands.
- How to point a domain to your server or appTo point a domain to your server or app, create a CNAME (or A) record in your registrar's DNS panel. Steps, how to test it, and common mistakes.
- Cache-Control headers explainedCache-Control is the HTTP header that sets how long browsers and CDNs keep a response. Learn max-age, no-cache, immutable and ready-made recipes for each file type.