Skip to content
FormSubmit
Static hosting

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.

FormSubmit Team

5 min read

Cloudflare dashboard creating a Pages project with Connect to Git and drag and drop options

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 integrationDirect Upload
How it deploysBuilds on every push to GitHub or GitLabYou upload prebuilt files
Build stepCloudflare runs it (500 builds/month on Free)You build locally or in CI
Preview deploymentsAutomatic for non-production branchesNot automatic
ToolsDashboard onlyDashboard drag-and-drop or Wrangler CLI
Switch latern/aCan'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:

sh
npx wrangler pages project create

Then deploy your output folder whenever you change something:

sh
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:

  1. In Workers & Pages, open your project and select Custom domains.
  2. Select Set up a domain, enter the domain and select Continue.
  3. 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 a CNAME pointing to your-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:

sh
npm create cloudflare@latest -- my-static-site

Then deploy it:

sh
npx wrangler deploy

The 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.

Frequently asked questions

Is Cloudflare Pages free for static sites?

Yes. Static asset requests are free and unlimited on the free plan. Limits apply to builds (500 a month), files (20,000 per site) and file size (25 MiB).

What build settings does a plain HTML site need on Cloudflare Pages?

Leave the build command blank and set the build output directory to the folder that contains your index.html, such as the repository root or a public folder.

What is Cloudflare Pages Direct Upload?

Direct Upload lets you deploy prebuilt files without connecting a Git repository, either by dragging and dropping them in the dashboard or with the Wrangler CLI command npx wrangler pages deploy followed by your output folder.

Can I switch a Direct Upload project to Git integration?

No. Cloudflare's docs say that if you choose Direct Upload, you cannot switch to Git integration later. You would create a new project connected to Git instead.

Should I use Cloudflare Pages or Workers for a new static site?

Cloudflare now recommends Workers with static assets for new projects, and Pages continues to work. Pages is simpler if your domain's DNS stays with another provider, since Workers custom domains need the zone on Cloudflare nameservers.

How do preview deployments work on Cloudflare Pages?

With Git integration, the production branch deploys your live site and every other branch gets its own preview deployment. Preview deployments are unlimited on the free plan.

Keep reading

Your form backend is 60 seconds away

Sign up with Google or email, create a form, paste the endpoint. Free forever for small sites — no credit card.