How to Host a Basic HTML File for Free (Without Paying a 'Web Host')
Table of Contents
You wrote a single HTML file. Maybe some CSS, maybe a bit of JavaScript. Now you Google “how to host a website” and land on a page telling you to buy a shared hosting plan for $9.99/month, pick a “hosting tier,” and configure a cPanel account you’ve never heard of.
None of that is necessary. A plain HTML file, or a small static site with a handful of pages, can be hosted for free, forever, on infrastructure run by Cloudflare or GitHub. No credit card. No “starter plan.” No renewal-price trap waiting for you in year two.
This is the part of the hosting industry that budget hosts don’t want you to notice: static file hosting costs the provider almost nothing to serve, because there’s no server-side code running and no database to manage. It’s just files, delivered from a CDN. Yet somehow it gets sold in the same box as a full LAMP stack with a MySQL database and PHP execution, at the same price. That’s the markup you’re being asked to pay for a job that doesn’t require it.
This guide covers the two hosts that are genuinely free (not “free trial,” not “free for 30 days”), a couple of honorable mentions with real caveats attached, and then the honest part: when a static file host actually stops being enough, and what to reach for instead.
What Static Hosting Means (and When It’s Enough)
“Static” means the files you upload are exactly what the visitor’s browser receives. HTML, CSS, JavaScript, images, fonts. There’s no server running your code on each request, no database being queried, no PHP interpreter sitting behind the scenes. The host’s job is just to store your files and hand them to whoever asks, as fast as possible, usually from a global network of edge servers.
That sounds limited, and in one sense it is: nothing happens on the server. But “nothing happens on the server” describes more of the web than the hosting industry likes to admit. Static hosting genuinely covers:
- A landing page for a product, event, or business
- A portfolio site
- Documentation for a project or API
- A resume or personal site
- A small brochure site for a local business with no booking system
- Anything built with a static site generator (Astro, Hugo, Eleventy, Jekyll) that outputs plain HTML at build time
Modern JavaScript frameworks blur the line a bit. Sites built with React, Vue, or a static site generator can still ship as static files if they don’t need a live backend, they just get compiled (“built”) into HTML/CSS/JS before upload. If your site doesn’t need to save data a visitor submits, log people in, or generate a page differently based on who’s asking, it’s a candidate for static hosting. If it does need any of that, keep reading, we get to the honest gate later in this post.
Option 1: Cloudflare Pages (Free)
Cloudflare Pages is, for most people asking “where do I put this HTML file,” the best default answer available today. You either connect a GitHub/GitLab repository (so every push automatically rebuilds and redeploys the site) or you drag and drop a folder of files straight into the dashboard for an instant deploy. No build step is required for a plain HTML site, if you’ve got static files, you can be live in under a minute.
What’s genuinely free, no asterisk:
- Hosting for static sites, with your files served from a large global network of edge locations
- A free
pages.devsubdomain the moment you deploy - Automatic SSL/HTTPS on that subdomain and on any custom domain you attach
- Git-based deploys, so pushing to your repo triggers a new build automatically
- Attaching your own custom domain (if the domain is already using Cloudflare’s nameservers, this is close to instant)
The pros: it’s fast (Cloudflare’s edge network is one of the largest in the industry), the free tier is not a crippled trial, and the workflow (push to git, get a deploy) is the same workflow professional teams use. The cons: build minutes and concurrent build limits do exist on the free plan, so if you’re rebuilding constantly or running a large team, you’ll eventually bump into a ceiling. For a personal site, a portfolio, or a small business page, you’re unlikely to notice it.
I’ve written a full breakdown of everything Cloudflare gives away for free versus what competitors charge for the same features. It’s worth reading if you want the complete picture, not just the hosting piece: Cloudflare Free Tier: What You Actually Get.
Option 2: GitHub Pages (Free)
GitHub Pages is the other genuinely-free option, and it has one advantage Cloudflare Pages can’t match: if your project already lives in a GitHub repository, you’re most of the way there already.
How it works: you push your HTML files to a GitHub repo (either to a branch named gh-pages, a /docs folder, or via a GitHub Actions build step for static site generators), flip on Pages in the repo settings, and GitHub serves the contents at a username.github.io URL. If the repo is named username.github.io itself, that becomes your root site. Any other repo gets served at username.github.io/repo-name/.
What’s free:
- Hosting for static sites directly off a GitHub repository
- A
github.iosubdomain - Free SSL/HTTPS, including on a custom domain you attach
Pros: dead simple if your code is already on GitHub, no separate account to create, and it plays nicely with GitHub Actions if you need a build step. Cons: it’s explicitly meant for personal, project, or organization sites rather than heavy production traffic, there’s no server-side processing (same as any static host), and attaching a custom domain requires you to add a CNAME file to the repo plus set DNS records yourself, an extra step compared to Cloudflare’s more integrated domain flow. It’s also worth knowing GitHub Pages sites are public repos by default unless you’re on a paid GitHub plan that supports private-repo Pages.
Both Cloudflare Pages and GitHub Pages are plain free static hosts, not affiliate products. There’s no commission attached to recommending either one, which is exactly why they’re first on this list.
Other Free Routes, Honestly
Cloudflare Pages and GitHub Pages aren’t the only free static hosts, just the two with the fewest catches. A couple of others come up constantly, so here’s the honest version of each.
Netlify has a genuinely useful free tier for static sites and offers a similarly smooth git-based deploy flow. The catch: its free tier has a monthly build-minutes allowance and a bandwidth allowance that a growing site can hit faster than you’d expect, and Netlify’s pricing has a habit of jumping hard the moment you cross into their paid tiers. Fine for a small personal project; annoying if the site starts getting real traffic.
Vercel is built primarily for Next.js and other JavaScript frameworks, and its free (“Hobby”) tier is explicitly licensed for personal, non-commercial use. If you’re hosting a business site or anything generating revenue, you’re expected to be on a paid plan, even if the traffic is tiny. That’s an easy detail to miss, and one that budget-conscious business owners specifically should not overlook.
Neither of these is a bad option. They’re just each one caveat away from “actually free for what you’re doing,” which is why Cloudflare Pages and GitHub Pages lead this guide.
When Free Static Is NOT Enough
Here’s the honest gate, and the reason this post doesn’t just end after “use Cloudflare Pages.” Static hosting has a real ceiling, and pretending otherwise would be the same dishonesty this whole post is arguing against.
You’ve genuinely outgrown static hosting if you need any of the following:
- Server-side code that runs on each request - processing a form submission with custom logic, calling a private API with a secret key, generating a PDF, running a scheduled job
- A database - user accounts, saved preferences, a comments section that isn’t a third-party widget, anything that needs to persist data a visitor creates
- PHP or WordPress - WordPress is server-side software that needs PHP execution and a MySQL database on every request; it fundamentally cannot run on a static host, no matter how the file structure looks
- Transactional email sending from your own backend - password resets, order confirmations, anything that needs a server to trigger the send (you can still use a third-party form service on a static site, but a full mailing pipeline usually wants a backend)
- A genuinely dynamic app - a dashboard, a SaaS product, anything where the page content depends on who’s logged in and what they’ve done
None of that is a static host’s fault, and none of it means Cloudflare Pages or GitHub Pages are “bad.” It just means the job changed. A brochure site and a web app with user accounts are different categories of problem, and no free static host was ever going to solve the second one.
Where to Go When You Outgrow Static
If you’ve read the list above and recognized your project, this is the point where paying for hosting actually makes sense, not before.
If you’re comfortable with a terminal and want full control at the lowest possible price, a cheap VPS is the move. You install exactly what you need (Node, Python, a database, whatever your backend requires) and you’re not paying for a managed layer you won’t use. Hetzner is consistently the best price-to-performance option in this category, and it’s what I point technical readers toward when they’ve outgrown static hosting and know their way around a server.
If you need WordPress, a database-backed site, or you just don’t want to manage a server yourself, managed hosting is the better trade, you’re paying for someone else to handle the server layer so you can focus on the site. A few options worth comparing, each with a different strength:
- Hostinger - solid budget entry point for WordPress and general shared hosting, a reasonable starting price for a first dynamic site
- ChemiCloud - managed hosting without the CPU-throttling games some budget hosts play, worth it if you’ve been burned by a host slowing you down at “peak hours”
- HostArmada - another managed option worth comparing on price and support quality before you commit
The point isn’t that one of these is universally “best.” It’s that once you actually need server-side code or a database, you’re no longer shopping in the same category as “where do I put an HTML file,” and the right host depends on how much server management you want to do yourself.
FAQ
Can I use a custom domain for free? Yes, on both Cloudflare Pages and GitHub Pages. You still have to buy the domain itself from a registrar (that part was never free anywhere), but attaching it to your free static host and getting SSL/HTTPS on it costs nothing extra.
Is free hosting really free forever, or is this a trial? For Cloudflare Pages and GitHub Pages specifically, it’s an ongoing free tier, not a time-limited trial. There’s no card required and no auto-upgrade after 30 days. That said, free tiers can change their terms over time (that’s true of any company’s free offering), so it’s worth keeping an eye on the provider’s current terms if you’re relying on it for something important.
Can I host WordPress for free? No. WordPress needs PHP execution and a MySQL database running on every page load, which static hosts, by definition, don’t provide. If you need WordPress, you need real hosting; that’s exactly the “outgrow static” case covered above.
Will a free static host handle real traffic if my site gets popular? Better than most people expect. Cloudflare in particular is built on the same edge network it sells to enterprise customers, so a static site getting a traffic spike is usually fine. Where you’d hit a wall is build minutes if you’re rebuilding constantly, not raw traffic to already-built files.
Do I need to know how to code to use Cloudflare Pages or GitHub Pages? Not really, for the simplest case. If you already have an HTML file, dragging a folder into Cloudflare Pages’ dashboard is close to zero setup. GitHub Pages assumes a little more comfort with git, since you’re pushing files to a repository. Neither requires you to write server-side code, because there isn’t any to write.