How to host websites for free with Cloudflare + Claude Code
By David Rosic, Website Development Expert · 2026-07-28
Cloudflare hosts websites for free. Not a trial and not a stripped down teaser tier: real hosting with a global CDN, DDoS protection, free SSL and custom domains, and no bandwidth bill, for up to 100,000 requests a day. For most business websites, that means the true cost of hosting is zero. Every site Rosic Analytics and Solutions builds runs on it, and once Claude Code holds an API token, the whole thing is managed by prompting.
Why the free tier is THAT good
Cloudflare is playing for market position. It currently sits in front of roughly 23% of all websites on the internet, and about 83% of every site that runs behind any reverse proxy at all. That scale is the product: the more of the web behind their network, the better their security data, and the more default the choice becomes for everyone else. Giving away hosting for smaller sites costs them very little and wins them the starting position on a huge share of new projects, some of which eventually grow into paying customers.
That is exactly what happened to us. Our agency's usage eventually outgrew the free tier, we started paying, and the pricing was reasonable enough that it never felt like a trap springing. The free tier is a genuine product tier, not a trial. For most small agencies, or even singular businesses that want to host their site for free, the free tier is perfect.
What you get for nothing
The numbers, straight from Cloudflare's plans page:
- 100,000 requests a day to your Worker, resetting at midnight UTC
- Static assets are free and do not count against that limit. On a normal business site, almost every request is a static asset, which is why these sites cost nothing to serve
- Unmetered bandwidth. No per gigabyte charge, which is the single biggest difference from most competitors
- A free workers.dev subdomain per project, live over HTTPS immediately
- Custom domains sold at cost, with certificates issued and renewed automatically
- D1 database: 5GB storage, 5 million rows read a day
- R2 file storage: 10GB with no egress fees, and KV: 1GB
- And the things you would normally buy separately are on by default: global CDN, DDoS protection, SSL, bot filtering
The plain English version: as long as the sites you host are not regularly pulling in six figures of dynamic requests a day, Cloudflare hosting is free. For most businesses that ceiling is far beyond anything they will see, and you can run many sites on one account. Companies operating at a completely different scale are having a different conversation entirely, and even then, the paid pricing is fair.
What this means if an agency hosts your site
Knowing the real cost of hosting changes how you should read your agency's invoice. If you run a small or mid sized business and the agency that built your site charges more than $50 a month just for hosting and maintenance, question it: the hosting part costs them nothing, or close to it. If they are charging $100 or more a month for it, get rid of them.
The only time a significant hosting charge is justified is when a site is genuinely large: more than 10,000 requests a day, the point where an agency hosting many sites on shared limits starts carrying real infrastructure costs. A five page site for a small business is nowhere near that, and a hosting line priced like it is tells you something about the rest of the invoice.
The part competitors get wrong
Here is what happens on other hosts when traffic spikes: Netlify sent one person a $104,500 bill after their small static site got hit with 190TB of traffic in four days. Vercel billed another user for 11 million requests made by Meta's web crawler. Neither platform lets you set a hard spending cap.
On Cloudflare's free plan, exceeding the daily limit produces an error page or passes traffic straight through to your static files, whichever you configure. It does not produce an invoice. For anyone who has ever woken up to a surprise hosting bill, that design difference is the entire argument.
Connecting Cloudflare to Claude Code
The setup is one time.
1. Create an API token. In the Cloudflare dashboard: profile, API Tokens, Create Token. Do not use the Global API Key, which has full account access and cannot be scoped. Create a token with only the permissions you need, typically Workers Scripts edit and Zone DNS edit.
2. Give it to Claude Code securely. Store it as an environment variable or in a secret store. Never paste a token into a chat window, commit it to a repository, or leave it in a file that syncs to cloud storage.
3. Prompt from there. Cloudflare becomes something you direct rather than navigate:
Deploy this site to Cloudflare Workers and point mydomain.com at it, with www redirecting to the apex.
Add a 301 redirect from /old-services to /services at the edge.
Check the DNS records on this domain and tell me if anything is pointing somewhere it should not be.
This site's deep links are 404ing. Look at the Workers config and fix the routing.
That last one is the most common real world problem with hosting a modern JavaScript site: single page apps need the asset config set to serve index.html for unknown paths, and that same setting quietly stops Worker code from running on browser navigations while scripted tests still pass. Asking Claude to check for exactly that failure is faster than discovering it in production.
One addition worth making
Search engines index JavaScript apps inconsistently. We prerender every route to static HTML after the build, so crawlers get complete markup, titles and structured data in the first response while visitors get the interactive app. It is a small script, it is a natural thing to ask Claude Code to add to your build, and it is the difference between a site that ranks and one that does not.
Questions, answered
Is Cloudflare's free plan allowed for commercial use?
Yes. Pages and Workers are part of Cloudflare's developer platform and business sites are squarely within the terms. The old restriction people still quote about non-HTML content was rewritten years ago and now concerns serving video and very large files.
What happens if I go over 100,000 requests a day?
Requests either bypass the Worker or get an error page for the rest of the day, your choice. You do not get billed. Static assets do not count toward the limit at all.
How much should an agency charge for website hosting?
For a typical business site, close to nothing: the hosting itself is free on Cloudflare. If an agency charges more than $50 a month just for hosting and maintenance on a small business site, question it. At $100 or more, get rid of them. Meaningful hosting charges only make sense for genuinely large sites doing more than 10,000 requests a day.
What is the catch?
The honest answer: the real limits are 500 builds a month, 20,000 files per site, and 100 custom domains per project. A normal business site touches none of them. Cloudflare gives this away because free users make their network smarter and some grow into paying customers.
Do I have to pay for SSL or a domain connection?
No. Certificates are issued and renewed free, and connecting your own domain costs nothing. Buying the domain itself at Cloudflare Registrar is at cost, with no markup.
Is the bandwidth really unmetered?
Yes. There is no bandwidth line item on any Cloudflare plan. That is the difference that produces $100,000 horror stories elsewhere and not here.
Want this set up without doing any of it yourself?
This is the kind of system we build for businesses. Reach out and tell us what you want off your plate.