Skip to content
rawandev.top
Get deals by email

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.

cloudflare static sites tutorial

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

  1. Build your site locally. For Astro: npm create astro@latest, then npm run build. The finished site is in the dist folder.
  2. Push the project to GitHub.
  3. Create a project in Cloudflare. In the dashboard open Workers & Pages, create an application and connect your GitHub repository.
  4. Set the build command (npm run build) and the output folder (dist).
  5. Deploy. Cloudflare gives you a free *.pages.dev or *.workers.dev address.
  6. 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.

Feedback on this page Wrong price, expired coupon, missing provider? Tell us.