How to Deploy a Static Site to Cloudflare Pages for Free (2026)
Deploy a static site to Cloudflare Pages for free with Git integration, drag-and-drop or Wrangler, then add a custom domain. Includes a Workers alternative.
5 min read

To deploy a static site to Cloudflare Pages, open Workers & Pages in the Cloudflare dashboard, select Create application, then either connect a GitHub or GitLab repository or drag and drop your files. For plain HTML, leave the build command blank and point the output directory at the folder holding index.html. You can also deploy from the terminal with npx wrangler pages deploy.
This tutorial covers both deployment routes, build settings, custom domains and preview deployments, and ends with a short Workers alternative. For the bigger picture, see our guide to static site free hosting.
Limits checked 14 October 2026 against each provider's official docs. Free plans change often; check the linked pages before you commit.
Before you start: Git integration or Direct Upload?
Cloudflare Pages offers two ways to deploy, and you choose when you create the project.
| Git integration | Direct Upload | |
|---|---|---|
| How it deploys | Builds on every push to GitHub or GitLab | You upload prebuilt files |
| Build step | Cloudflare runs it (500 builds/month on Free) | You build locally or in CI |
| Preview deployments | Automatic for non-production branches | Not automatic |
| Tools | Dashboard only | Dashboard drag-and-drop or Wrangler CLI |
| Switch later | n/a | Can't switch to Git integration |
The last row matters: Cloudflare's Direct Upload docs say that if you choose Direct Upload, you cannot switch to Git integration later. If you want automatic deploys eventually, start with Git.
Both routes share the free plan limits: unlimited static requests, 20,000 files per site and 25 MiB per file. Details are in Cloudflare Pages free plan limits.
Route 1: deploy with Git integration
This follows Cloudflare's Git integration guide.
Push your site to GitHub or GitLab
Your repository should contain an index.html at the root or in a folder such as public.
Create a Pages project
In the Cloudflare dashboard, go to Workers & Pages. Select Create application, then Pages, then Connect to Git.
Authorise and pick the repository
Sign in to your Git provider, select the repository, then choose Install & Authorize and Begin setup.
Configure the build
On the "Set up builds and deployments" screen, choose your production branch. For a plain HTML site, leave the Framework preset unset and the Build command blank, and set the build output directory to the folder that holds index.html (for example / or public). If you use a static site generator, pick its preset and Cloudflare fills in the usual command and folder.
Save and Deploy
Select Save and Deploy. When the build finishes, your site is live on a *.pages.dev subdomain based on the project name.
From now on, every push to the production branch updates the live site. Pushes to any other branch create preview deployments.
Route 2: Direct Upload with drag and drop
Drag and drop suits a simple site you build by hand.
Start a new upload project
In Workers & Pages, select Create application, then Get started, then Drag and drop your files.
Name the project and add files
Enter a project name, then add your site's files.
Deploy
Select Deploy site, then Save and Deploy once the upload completes.
To ship changes later, open the project and select Create a new deployment. Drag and drop is limited to 1,000 files and 25 MiB per file, so use Wrangler for anything larger.
Route 3: Direct Upload with the Wrangler CLI
Wrangler is Cloudflare's command-line tool, and you can run it with npx without a global install. These commands are from the Direct Upload docs.
Create a project once:
npx wrangler pages project createThen deploy your output folder whenever you change something:
npx wrangler pages deploy <BUILD_OUTPUT_DIRECTORY>For a plain HTML site in a folder called public, that's npx wrangler pages deploy public. Wrangler asks you to log in the first time.
How to add a custom domain to Cloudflare Pages
Custom domains get free HTTPS. Cloudflare's custom domains docs describe the steps:
- In Workers & Pages, open your project and select Custom domains.
- Select Set up a domain, enter the domain and select Continue.
- Follow the DNS instructions.
How the DNS works depends on the domain:
- Apex domain (
example.com): it must be a Cloudflare zone, meaning your nameservers point to Cloudflare. Cloudflare then creates the record for you. - Subdomain (
www.example.com): it can stay at your current DNS provider. Add aCNAMEpointing toyour-project.pages.dev.
Add the domain in the Pages dashboard before creating the CNAME. Cloudflare warns that adding the record manually first can cause a 522 error. For more on DNS and certificates, see free custom domain and HTTPS for a static site.
How do preview deployments work?
With Git integration, the production branch deploys the live site and every other branch gets a preview deployment with its own URL. Previews can update your pull requests, so reviewers see changes before they merge. Preview deployments are unlimited on the free plan, though each one triggered by a push uses a build.
The Workers alternative for new projects
Cloudflare now recommends Workers with static assets for new projects, and its April 2025 announcement says "Pages continues to work, but new features and optimizations are focused on Workers." The free static limits are similar: static asset requests are free and unlimited, with 20,000 files and 25 MiB per asset.
From Cloudflare's static assets get started guide, create a project and choose Static site when prompted:
npm create cloudflare@latest -- my-static-siteThen deploy it:
npx wrangler deployThe one catch for static sites: Workers custom domains require your zone to use Cloudflare nameservers, while Pages can serve a subdomain whose DNS lives elsewhere. If moving DNS isn't an option, stick with Pages. Our Cloudflare Pages limits post compares the two in more detail, and Netlify vs Vercel vs Cloudflare Pages compares Cloudflare with other hosts.
Add a working contact form to your static site
Cloudflare Pages serves your HTML but doesn't process form submissions, so a contact form needs a Pages Function or an external endpoint. Pointing the form's action at a FormSubmit endpoint needs no server code and doesn't use your Workers request quota. The free plan includes 1 form and 50 submissions a month; start from our email form page or the HTML contact form guide.


