← All docs

Cloudflare · Hosting · Web

Host your website on Cloudflare for free

Publish an HTML, CSS and JS site on Cloudflare for $0 a month. Drag and drop in the dashboard or one command, connecting your own domain, and the mistakes I made.

Time
10 min
Level
Beginner
Steps
5
Prompts
2
Download PDF ↓

The tech review site from the video is live at incele-demo.dec5.workers.dev, and I pay nothing for hosting. Below is how to do the same with your own site, step by step. Hit Copy in the top right of any command or prompt, paste it, keep going.

What we're making

Cloudflare is an infrastructure company that runs behind a big part of the internet. It has servers in 300+ cities. When you put your site there, a copy is spread across all of them, and visitors load it from the closest one.

Why is it free? Its network already exists, so carrying a small site costs it almost nothing. It's betting that the developer using it for free today gets their company on a paid plan tomorrow.

You'll end up with three things:

  1. A free, live address ending in .workers.dev
  2. A way to republish whenever you update the site
  3. Your own domain, if you want one
  1. Put your site in one folder

    You'll upload a folder, and index.html has to be at its root. Mine looks like this:

    text
    teknoloji-inceleme-demo/
    ├── index.html
    ├── styles.css
    ├── app.js
    └── img/
    

    If your site uses a framework (React, Vite, Next.js), build it first and use the output folder. Not sure? Ask Claude Code:

    Prompt
    I'm going to deploy this project to Cloudflare as a static site.
    
    1. Is the project static, or does any part of it run on a server? Tell me.
    2. If it's static, run the build and tell me which folder to upload (dist, out, build, etc.).
    3. Check that index.html is at the root of that folder and that image paths are relative.
    
    Don't deploy anything yet.
    
  2. Upload from the dashboard (easiest)

    1. Open the Cloudflare dashboard.
    2. Go to Workers & Pages in the sidebar and create a new application.
    3. Choose the file upload option (shown as "Upload" or "Drag and drop").
    4. Name the project. Your address is built from this name.
    5. Drag your folder in and hit Deploy.

    Within a minute the site is live at project-name.account-name.workers.dev. Cloudflare renames dashboard buttons from time to time; if it doesn't match exactly, follow the same path: Workers & Pages → create → upload files.

  3. Or deploy with one command

    The command line is faster for every update after the first. You can run Cloudflare's tool, Wrangler, through npx without installing it.

    First connect your account. A browser opens; sign in and hit Allow:

    Terminal
    npx wrangler@latest login
    

    Then go inside your site folder and deploy:

    Terminal
    cd teknoloji-inceleme-demo
    npx wrangler@latest deploy --assets . --name incele-demo --compatibility-date 2026-10-01
    

    --name is your project name, and the address is built from it. The command prints the live address at the end.

    You can also have Claude Code do it:

    Prompt
    Deploy the static site in the <FOLDER PATH> folder to Cloudflare.
    
    - First check that I'm logged in with `npx wrangler@latest whoami`. If not, stop and tell me to run `npx wrangler@latest login`.
    - ALWAYS run the command from inside that folder: npx wrangler@latest deploy --assets . --name <PROJECT NAME> --compatibility-date 2026-10-01
    - If more than one Cloudflare account shows up, ask me which one to use.
    - When it's done, open the live address and check that the page, CSS, JS and images return 200.
    
  4. Connect your own domain (optional)

    The .workers.dev address is free and permanent. If you want your own name:

    1. Get a domain. You can buy one at cost in the Cloudflare dashboard under Domain Registration (around $10/year for .com), or buy it elsewhere and move it to Cloudflare.
    2. Open your project in Workers & Pages and add a Custom domain under Settings → Domains & Routes.
    3. Type the domain and save. Cloudflare sets up the HTTPS certificate itself.

    The domain costs money; hosting is still free.

  5. Update the site

    Changed something? If you used the dashboard, upload a new version to the same project. If you used the command, run it again:

    Terminal
    npx wrangler@latest deploy --assets . --name incele-demo --compatibility-date 2026-10-01
    

    Only changed files get uploaded, and you can roll back to an older version from the dashboard in one click.

Tips

I ran the command in the wrong folder. Run from another project's folder, Wrangler detected that project, tried to deploy it, and changed its files to fit Cloudflare. The deploy failed so nothing went live, but I had to undo the changes by hand. Always run the command from inside your site folder, and check for index.html with ls first.

The address didn't open right away. A new workers.dev address can take a minute or two to work everywhere. Wait and try again.

The page loads but the images don't. Your image paths may be full paths to your own computer, like /Users/.... They all need to be relative, like img/photo.jpg.

I got .workers.dev, not .pages.dev. Cloudflare moved Pages into Workers. New projects get a workers.dev address; both are free.

More than one account showed up. Wrangler lists every account you can access. Pick the right one by putting CLOUDFLARE_ACCOUNT_ID=<account id> in front of the command.

Done?

  • My site is in one folder, with index.html at the root
  • I created a Cloudflare account
  • I deployed from the dashboard or with the command, and the .workers.dev address opens
  • Images and styles load on the live address too
  • (Optional) I connected my own domain

Stuck somewhere? Tell me on Instagram and I'll add it to the guide.