How to Host a Website for Free with Cloudflare Pages or GitHub Pages
Put a portfolio, blog or small business site online for $0. A step-by-step guide to Cloudflare Pages and GitHub Pages, plus their real limits.

You can put a fast, professional website online without paying for hosting at all. The catch is that it needs to be a static site: pages that are built ahead of time, like a portfolio, a blog, documentation or a small business landing page. No logins or databases.
That covers a surprising number of websites. This one included.
The two best free options are Cloudflare Pages and GitHub Pages. Here's how they compare, then how to use each.
The free limits
| Cloudflare Pages | GitHub Pages | |
|---|---|---|
| Bandwidth | No published monthly cap | 100 GB/month (soft limit) |
| Site size | Up to 20,000 files, 25 MiB per file | 1 GB |
| Builds | 500 per month | 10 per hour (soft limit) |
| Custom domain | Yes, free HTTPS | Yes, free HTTPS |
| Business or shop sites | Allowed | Not intended for online businesses or e-commerce |
The big difference: GitHub says Pages isn't meant to be free hosting for online businesses or shops. For a personal site, portfolio or open-source docs, it's perfect. For a business site, Cloudflare Pages is the safer choice.
Option 1: Cloudflare Pages
- Put your site in a GitHub repository. Even a single
index.htmlfile works. - Create a free Cloudflare account and go to Workers & Pages.
- Click Create, choose Pages, and connect your GitHub account.
- Pick your repository. If you use a framework (Next.js, Astro, Hugo and others), choose it from the list so Cloudflare knows how to build it. For plain HTML, leave the build settings empty.
- Click Save and Deploy.
A minute later your site is live at your-project.pages.dev. Every time you push a change to GitHub, Cloudflare rebuilds and redeploys automatically.
To use your own domain: open the project, go to Custom domains and add it. If your domain's DNS is already on Cloudflare, it takes a couple of clicks.
Option 2: GitHub Pages
- Create a repository on GitHub. Name it
yourusername.github.iofor a personal site. - Add an
index.htmlfile with your page. - Go to the repository's Settings → Pages.
- Under Source, choose to deploy from your main branch (or a GitHub Actions workflow if your site needs building).
- Wait a minute, then visit
https://yourusername.github.io.
Custom domains are set up in the same Pages settings screen.
Don't know how to make the site itself?
Some easy starting points:
- Plain HTML and CSS: perfect for a one-page portfolio. Free templates are everywhere.
- Astro or Hugo: great for blogs and documentation, with lots of starter themes.
- Next.js with static export: what this site uses. More to learn, but very flexible.
If you'd rather not touch code at all, a website builder is easier, though you'll pay monthly. We compare them in The Best Website Builder for a Small Business.
What you'll still pay for
- A domain name. Roughly $10 to $15 a year for a
.com. Cloudflare sells domains at cost. - Email at your domain, if you want
hello@yourname.com. See the best private email services.
That's it. No hosting bill, free HTTPS, and a site served from a global network that's fast everywhere.


