← All writing
Hosting

Host a Website Free on Cloudflare Pages

YOUR HOSTING BILL · $0.00

Your website can cost nothing.

Not a free trial. Not cheap for the first year. A real website, on your own domain, with the padlock in the address bar, for zero — and it stays zero when a thousand people arrive at once.

Ten years ago this needed a server, a monthly invoice, a certificate you renewed by hand, and one bad night when your site got popular. Today it needs a folder of files and about five minutes.

THE OLD WAY 6 CHORES Rent a server Install nginx Buy a certificate Set up a firewall Patch it monthly Set up backups …and a bill every month, plus one bad night when the site gets busy. CLOUDFLARE PAGES Push your files. That is the list. $0 / month

This guide is for anyone with a website to put online — a portfolio, a small business page, a landing page, a blog, a college project. No jargon that is not explained, and a picture wherever a picture helps.

What is Cloudflare Pages?

Cloudflare Pages is a free home for the files that make up your website.

You hand it a folder. It copies that folder onto computers in hundreds of cities around the world. When somebody opens your site, the copy nearest to them answers. That is the whole idea, and everything else in this article is a detail of it.

There is no server that belongs to you. Nothing to log into, nothing to keep patched.

First, one word: “static”

Nearly every free-hosting article assumes you know this word. It is simpler than it sounds.

STATIC — files already finished The pages were made once, before anybody visited. .html .css .js .png Visitor gets the file as-is Portfolios · blogs · landing pages · docs · brochure sites React, Vue, Astro, Next (export), Hugo, Jekyll, plain HTML Cloudflare Pages hosts this, free. DYNAMIC — built on every visit A program runs, asks a database, then writes the page. Visitor Server runs code Database costs money, needs care Shops with live stock · dashboards · social apps WordPress, Laravel, Django, Rails Needs a server somewhere. Not free.
If your site looks the same to every visitor until you change it yourself, it is static — even if it was built with React and looks like an app.

A site is not “simple” because it is static. This blog is static. Documentation for huge products is static. What matters is only this: were the pages made in advance, or does a program have to make each one on demand?

If they were made in advance, you do not need a server, and you should not pay for one.

And who is Cloudflare?

Cloudflare runs one of the largest networks on the internet. Their main business is sitting in front of other people’s websites to make them faster and to block attacks. They already have machines in hundreds of cities because that business needs them.

Pages lets you park your site directly inside that network. Serving static files is cheap for a network that size, so they do not charge you for it. That is why the free plan is believable rather than suspicious.

Why use it

REASON 01

Free means free

Unlimited bandwidth and unlimited visits to your files. No card needed to start, and no bill arrives on your busiest day.

REASON 02

No server to look after

Nothing to update, nothing to restart, nothing to be hacked at 2am. You cannot break a machine you were never given.

REASON 03

HTTPS, done for you

The padlock appears by itself and renews itself forever. No certificate to buy, no expiry date to write in a calendar.

REASON 04

Fast for everyone

Not just fast where you live. Your site sits near your visitors, wherever they are.

REASON 05

It survives attention

A flood of traffic and an actual attack look the same to Cloudflare, and it absorbs both. Blocking those is their day job.

REASON 06

Mistakes are cheap

Every version you ever published is kept. Broke the live site? Click the last good one and roll back.

Here is the honest version of the pitch. Hosting a static site is a solved problem, and the value is not what you get — it is the long list of things you never have to do again.

What you still do
  • Write your site.
  • Push it, or drag the folder in.
  • Type your domain name once.
What you never do again
  • Rent, choose or size a server.
  • Install and configure a web server.
  • Buy or renew an SSL certificate.
  • Apply security patches.
  • Pay a monthly invoice.
  • Panic when the site gets busy.

What you actually get for free

Numbers, not adjectives. These are the free-plan limits as of September 2026.

Bandwidth
∞
Unlimited. Requests to static files are free and uncounted, on every plan.
Websites
∞
As many separate projects as you like, on one free account.
Builds
500per month
About 16 publishes a day, every day. One build runs at a time.
Files per site
20,000
Counted per deployment. A big blog is a few hundred.
Largest single file
25MiB
Fine for images and PDFs. Video belongs elsewhere.
Custom domains
100per project
With free SSL on each one, issued automatically.

Also included and not usually free elsewhere: unmetered DDoS protection, automatic compression, HTTP/3, and a preview URL for every branch you push.

THE ONE CATCH WORTH KNOWING

All of the above is for files. If you add server-side code — a contact form handler, a small API — that is a Pages Function, and functions draw on Cloudflare's Workers free allowance of 100,000 requests a day. Still generous, still free, but it is a counter, and files are not.

Deploy a site, start to finish

There are two ways in. Pick by whether your site is on GitHub.

WAY A · RECOMMENDED

Connect your Git repository

Set it up once. After that, publishing your site is git push and nothing else. Cloudflare builds the site itself.

Best for: anything you will edit more than twice.

WAY B

Drag and drop a folder

No Git, no build step, no command line. You drag your finished folder onto the page and it is live.

Best for: a plain HTML site, or a one-off you want online in two minutes.

Way A — connect GitHub

1

Make a free Cloudflare account

Go to dash.cloudflare.com and sign up. No card, no trial clock.

2

Open Workers & Pages

In the left sidebar, under Compute. This one screen is where everything lives.

Account home
Domains
Build
Compute ⌄
Workers & Pages
Observability
Containers
3

Create application → connect to Git

Press the blue Create application button, choose to import a repository, and authorise GitHub. Cloudflare asks which repositories it may see — you can give it one, not all of them.

Workers & PagesCreate application
my-portfoliogithub/you/my-portfolio
4

Fill in three boxes

This is the only screen that ever confuses anybody, and it is three fields: what the project is called, the command that builds your site, and the folder that command produces.

my-portfolio
npm run build
dist
✓ Builds for non-production branches
Save and Deploy

Leave the build command empty if your site is plain HTML with no build step — then the output directory is just the folder holding index.html.

5

Watch it build, then open the link

A log scrolls past for roughly a minute. At the end you get a live address like my-portfolio.pages.dev, already on HTTPS. Your site is on the internet.

6

Add your own domain

Open the project → Custom domains → Set up a domain → type yoursite.com. If the domain's DNS is already with Cloudflare, the record is added for you. If not, you add one CNAME at your registrar. The certificate is issued on its own, usually within minutes.

What do I put in those two build fields? Find your tool in this table and copy the row.

Your site is built withBuild commandOutput directory
Plain HTML / CSS / JSleave empty/
Vite, React, Vue, Sveltenpm run builddist
Create React Appnpm run buildbuild
Astronpm run builddist
Next.js (static export)npx next buildout
Hugohugopublic
Jekylljekyll build_site
Docusaurusnpm run buildbuild

If the build fails complaining about your Node version, add an environment variable named NODE_VERSION with the value 22 and deploy again. That single setting is the most common first-build failure.

Way B — drag and drop

No repository, no build, no terminal. In the same Create application screen, choose the upload option and drag in either your folder or a .zip of it.

my-site/ index.html style.css DRAG Drop your files here up to 1,000 files · 25 MiB each LIVE my-site.pages.dev HTTPS already on
Two minutes, no terminal. The one thing to know: a drag-and-drop project cannot be converted to a Git-connected one later — you would make a new project.

Way C — one command, no Git connection

If you prefer the terminal, or you do not want Cloudflare reading your repository at all:

npx wrangler login              # authorise this computer, once
npx wrangler pages deploy dist  # upload the built folder

That is the whole deployment. This very site is published that way, on purpose: the repository it lives in also holds private things, so Cloudflare is never given access to it. The build happens on my laptop and only the finished folder is uploaded. Cloudflare cannot leak what it was never handed.

IF YOUR SCREEN LOOKS DIFFERENT

Cloudflare has been merging Pages into Workers, so the newer wizard may say Create an app, and show a Deploy command like npx wrangler deploy where the older one showed a build output directory. It is the same platform and the same free static hosting underneath. Existing Pages projects keep working, and for a plain static site either route lands you in the same place.

How to update your site

This is where the Git route earns its keep. You do not “upload changes”. You do not open an FTP client. You change a file and push it.

You edit fix a typo, add a page git push one command Cloudflare builds it noticed by itself ~1 minute Live, everywhere every city gets the new copy old version kept, just in case You never log into a server. What is in your repository is what is on the internet.
The whole update process. Push to your production branch and the live site follows, on its own.

Three things come free with that loop, and they are the reason people stay.

TRY BEFORE YOU PUBLISH

Every branch gets its own URL

Push a branch called new-design and you get a private-looking link showing exactly that version, live, with the real site untouched. Send it to a friend or a client before you commit to it.

UNDO

Rollback is one click

Open Deployments, find the version from before you broke it, press Rollback. It is live again in seconds — no rebuild, no re-upload.

NO GIT?

Re-drop the folder

Drag-and-drop projects update the same way they started: Create a new deployment, drop the folder again. Or re-run the one-line wrangler pages deploy.

What the CDN actually does

CDN stands for Content Delivery Network. Strip the phrase away and it means: your site is kept in many cities at once, so nobody has to fetch it from far away.

Distance is real time. Data does not travel instantly, and a request crossing an ocean and back can take a few hundred milliseconds — before the server has done anything. A normal page needs dozens of those trips. That is why a site hosted in one country feels slow in another, even when the server itself is fast.

WITHOUT A CDN — ONE SERVER, SOMEWHERE Dhaka Berlin Sydney one server Virginia, USA every file, every time, the whole way WITH CLOUDFLARE — A COPY IN EVERY CITY copy copy copy …and hundreds more the trip is across town
Same website, same files. The only thing that changed is how far the visitor's request has to travel — and that is most of what "fast" means on the web.

Two details that make Pages nicer than a CDN bolted onto normal hosting:

There is no "home" server behind it
  • A normal CDN keeps a temporary copy and goes back to your server when it expires. Your server still has to exist, and still has to be up.
  • With Pages, the files live on the network itself. There is nothing behind it to be slow, to be down, or to be attacked.
Handled for you, silently
  • Files are compressed before sending, so less travels down the wire.
  • Modern connections (HTTP/3) are used where the browser supports them.
  • A deploy replaces the copies everywhere — no cache to clear by hand.
  • Attack traffic is filtered before it reaches your site at all.
You are not buying hosting. You are borrowing a network that was already there.

Cloudflare Pages versus the others

All of these will host a static site for free. They differ in what happens on the day your site does well.

Cloudflare Pages Netlify Vercel GitHub Pages A $5 server
Price$0$0$0 (Hobby)$0~$5 / month
BandwidthUnlimited100 GB / month100 GB / month100 GB / month, softWhatever you pay for
Build allowance500 builds / month300 build minutes6,000 build minutes10 builds / hour, softYou run it yourself
Site size20,000 filesGenerousGenerous1 GB totalYour disk
Free custom domain + SSLYesYesYesYesYou set it up
Commercial use on free tierAllowedAllowedNot allowedAllowedAllowed
Private repositoryYesYesYesNeeds a paid plann/a
Server-side codeFunctions, 100k req/dayFunctions, 125k / monthFunctions, generousNone at allAnything you want
DDoS protectionIncluded, unmeteredBasicBasicBasicYours to solve
MaintenanceNoneNoneNoneNoneForever

Free-plan terms as published in September 2026, and they do move — check the current page before betting a business on a row. Netlify moved to a credit-based free plan in late 2025; older accounts kept the bandwidth-and-minutes shape shown here.

So which one?

Cloudflare Pages

A static site you do not want to think about again. The unlimited bandwidth is the real difference: a post that goes viral costs you nothing, on any other free tier it starts a countdown.

Vercel

A serious Next.js application using server rendering. It is smoother there, and it is their own framework. Remember Hobby is personal use only — a client site belongs on a paid plan.

GitHub Pages

A small public project already on GitHub. It is a checkbox in settings. But: public repositories only on the free plan, 1 GB, and no server-side code, ever.

And if you genuinely need a database, background jobs and long-running processes, a small server is honest work. Just do not rent one to serve a folder of HTML.

The small print nobody mentions

BUILDS

500 a month is plenty, until a bad afternoon

Every push to your production branch spends one build, and so does every push to every preview branch. A day of chasing one CSS bug can quietly spend twenty.

Test locally, push when you mean it. Or upload the built folder directly, which uses no build allowance at all.

BIG FILES

25 MiB per file is a hard wall

Photographs and PDFs fit easily. A video does not. Uploading one is the most common way a first deploy fails.

Put video on YouTube, Vimeo or Cloudflare Stream and embed it. Your visitors will thank you as well — nobody wants a 300 MB page.

ONE-WAY DOOR

Drag-and-drop cannot become Git-connected

If you start a project by uploading a folder and later want automatic deploys from GitHub, you have to create a new project and move the custom domain across.

If you already use Git, connect it on day one. It costs nothing extra and saves the migration.

EXPECTATIONS

Static means static

No PHP, no WordPress admin, no database on the box. Comments, forms and logins have to come from somewhere else — a Pages Function, or a third-party service.

This is a fair trade, not a limitation: it is exactly why there is no server to hack and no bill to pay.

Where to read more

One last thing

The site you are reading runs on exactly this. Pages for the files, one small function for the contact form, a tiny database behind it. It serves a full portfolio, this blog and every image on it.

It costs nothing per month, and there is no server anywhere with my name on it.

—claps

Worth something? Tap it — up to twenty times. It is anonymous, and the total is the only thing stored.

Related reading

Building something that needs this kind of engineer?

Hiring, contract, or an architecture problem — tell me the shape of it and I’ll come back with something specific.

Contact me →