How to host a static website for free on Cloudflare Pages in 2026

How to host a static website for free on Cloudflare Pages in 2026

Yes. Cloudflare Pages hosts a static website — plain HTML, CSS, JavaScript and images — for free, with no charge per visit, and serves it over HTTPS from Cloudflare's global network. You deploy it either by connecting a GitHub or GitLab repository, or by dragging your finished files into the dashboard, and you can add your own domain later.

A static website is a site made of finished files — no server code, no database, nothing to patch. You give Pages a folder of files, and it serves them worldwide. Every number below comes from Cloudflare's own Pages documentation, limits page updated 28 November 2026.

What you need before you start

You need a free Cloudflare account and your website's files, with an index.html file at the top level. If your site is built with a static site generator such as Hugo, Eleventy or Astro, build it on your own computer first so you have a folder of finished files ready to upload.

Two things are optional: a GitHub or GitLab account, needed only for the Git method, and a domain name of your own. Your site works fine on the free your-project.pages.dev address Pages gives you, and a custom domain can be added at any time. If you buy a domain, you pay the registrar for the name — the hosting stays free.

What the free tier actually includes

The hosting itself costs nothing, and Cloudflare does not charge per visit for a static site. What it limits instead is how much you can build, how many files a site can hold, and how many projects and domains you can attach. The numbers, from Cloudflare's Pages limits page:

LimitFree plan
Charge for static requestsNone — no charge per visit
Builds per month500
Builds at the same time1
Build timeout20 minutes
Files per site20,000
Largest single file25 MiB
Custom domains per project100
Projects per account100
Deployments kept30 days, plus the 100 most recent and the live production deployment

Note that the 500 builds a month are shared across every Pages project on your account, not per project, and only one build runs at a time. A deployment is one published version of your site, including previews; after 30 days, old ones are deleted unless they are among the 100 most recent or are currently live, and their preview links stop working.

The one thing that can cost money is server code. Pages Functions — code that runs when a visitor requests a page, for things like a contact form — count toward your Workers plan quota, not toward the free static hosting. A purely static site never touches that quota.

Git or drag-and-drop: choose before you create the project

Pages offers two ways to deploy, and you pick one when you create the project. The choice matters, because a project created with direct upload cannot be converted to a Git-connected project later. If you think you will ever want automatic deploys, start with Git.

Choose Git integration if you will update the site more than occasionally: every push to your production branch rebuilds and republishes it automatically, and every other branch gets its own preview link. Choose drag-and-drop if you built the site by hand and update it rarely. Both share the same free tier, limits and pages.dev address.

Method 1: Deploy from Git

This follows Cloudflare's Git integration guide.

  1. Push your site's files to a GitHub or GitLab repository — private or public both work.
  2. In the Cloudflare dashboard, go to Workers & Pages, then select Create application > Pages > Connect to Git.
  3. Select GitHub or GitLab, sign in when asked, and pick the repository.
  4. Select Install & Authorize, then Begin setup. Give the project a name — this becomes your site's address, your-project.pages.dev — and set the production branch, usually main or master. That branch deploys the live site; every other branch becomes a preview deployment.
  5. Set the build settings. For plain HTML, leave the build command blank and set the build output directory to the folder holding index.html, usually / or public. For a framework, pick its preset and Cloudflare fills in both values.
  6. Select Save and Deploy. Cloudflare installs dependencies, builds the project, and publishes it, then gives you a live URL.

After that, the workflow is just Git: push to the production branch and Pages rebuilds and republishes; push elsewhere and you get a preview link to check first.

Method 2: Drag and drop your files

This follows Cloudflare's direct upload guide. Direct upload means handing Pages a folder of files that are already built — there is no build step on Cloudflare's side, so build your site on your own computer first.

  1. In the Cloudflare dashboard, go to Workers & Pages, then select Create application > Get started > Drag and drop your files.
  2. Enter a project name. Your site will live at your-project.pages.dev.
  3. Drag your site's folder — or a zip of it — into the upload area, then select Deploy site. Once the files have uploaded, select Save and Deploy.
  4. Open the pages.dev address to check the live site.

To publish an update, open the project, select Create a new deployment, and upload the folder again. One practical limit: drag-and-drop is capped at 1,000 files, each no larger than 25 MiB. For a bigger site, use the Wrangler command line tool instead, which allows 20,000 files: after installing Wrangler and running wrangler login, create the project once with npx wrangler pages project create, then deploy with npx wrangler pages deploy <your-output-folder>.

Add a custom domain with automatic SSL

Your site starts on a pages.dev address, but a domain of your own looks more professional and is easier to remember. This follows Cloudflare's custom domains guide.

  1. In the Cloudflare dashboard, go to Workers & Pages, select your Pages project, then open Custom domains.
  2. Select Set up a domain, enter the domain you want to use, and select Continue.
  3. If it is an apex domain — example.com with nothing in front of it — the domain must be a zone in your Cloudflare account, with its nameservers pointed at Cloudflare. Cloudflare then creates the CNAME record for you.
  4. If it is a subdomain, such as blog.example.com, add a CNAME record at your DNS provider pointing to <your-site>.pages.dev. If Cloudflare already manages the domain's DNS, the record is added automatically after you confirm it.

Cloudflare issues the SSL certificate for your custom domain — you never upload, configure or renew a certificate yourself, and the site is served over HTTPS. One thing can block this: CAA records, DNS records that restrict which certificate authorities may issue certificates for a domain. If yours do not allow Cloudflare's authorities — Let's Encrypt, Google Trust Services and SSL.com — the certificate cannot be issued. Allow those three and the domain will activate.

Up to 100 custom domains can be attached to one project on the free plan, so adding both the apex domain and the www version is no problem.

The limits that actually matter

Most small sites will never touch these numbers, but it helps to know where the edges are.

  • 500 builds a month, shared across your account. Roughly 16 builds a day — generous for one site, thin if you run several projects that all rebuild on every push.
  • One build at a time. A slow build on one project blocks builds on your other projects until it finishes.
  • 20,000 files per site, 25 MiB per file. A blog or documentation site will never come close. A photo-heavy site, or one hosting video and large PDFs, will — those big files belong in dedicated storage, not on Pages.
  • 100 projects per account. Cloudflare says this limit is not routinely increased. If you need more sites, the answer is a different product, not a bigger Pages plan.
  • New accounts are throttled at first. Cloudflare limits how many new Pages projects you can create in your first 48 hours, as an abuse precaution. The restriction lifts by itself after that window.
  • Drag-and-drop uploads cap at 1,000 files. Use Wrangler, or Git integration, for anything larger.
  • Server code is metered separately. Pages Functions count toward your Workers plan quota. Keep the site static and the hosting stays free.

What to do next

Create a free Cloudflare account, build your site's files, and deploy with the method that fits how often you will update it. Check the live pages.dev address, then add your own domain whenever you are ready. If the numbers here ever stop matching the dashboard, the limits page linked above is the place to check.

Checked on 30 November 2026.

发表评论

评论 暂无评论

文章目录