22 Nov 2026
How to host a static website for free on Cloudflare
Build your site with a static site generator and put it online for free with a custom domain and HTTPS.
Not every website needs a server. Portfolios, blogs, documentation and landing pages can be plain HTML files. Cloudflare will host those files for free on its global network.
What "static" means
A static site is a folder of HTML, CSS, JavaScript and images. Tools like Astro, Hugo or Eleventy build that folder for you from templates and Markdown. Because nothing runs on a server, it is fast, cheap and hard to hack.
What you need
- A free Cloudflare account
- A GitHub account (optional, but makes updates automatic)
- A domain name — compare prices on domain prices
Steps
- Build your site locally. For Astro:
npm create astro@latest, thennpm run build. The finished site is in thedistfolder. - Push the project to GitHub.
- Create a project in Cloudflare. In the dashboard open Workers & Pages, create an application and connect your GitHub repository.
- Set the build command (
npm run build) and the output folder (dist). - Deploy. Cloudflare gives you a free
*.pages.devor*.workers.devaddress. - Add your domain. Add the domain to Cloudflare, change the nameservers at your registrar, and attach the domain to the project. HTTPS is set up automatically.
From now on, every push to GitHub rebuilds and redeploys the site.
When you need more
Need a contact form, a database or a login? Cloudflare Workers can run small pieces of server code next to your static files, with D1 as a database and R2 for images — exactly how this site works. When you outgrow that, look at VPS offers or cloud hosting.