Building a website on your own computer is only half the job; to share it, you need to deploy it, which means copying its files to a server that is always online and gives it a public address. For personal projects, portfolios and learning, you do not have to pay for that. Several reliable services host websites for free, with automatic HTTPS and a web address included.
A short history
Free hosting is almost as old as the web. In the 1990s, services such as GeoCities let millions of people build home pages in exchange for adverts; GeoCities closed in 2009. Later, platforms like Heroku offered free plans for full applications, but Heroku ended its free tier in 2022. Today the generous free offers focus on static sites, because serving ready-made files costs providers very little. The approach of building sites as static files and adding dynamic features through APIs became popular in the mid-2010s under the name Jamstack.
Static or dynamic: know what you are deploying
- Static site: HTML, CSS, JavaScript and images that the server sends exactly as they are. Portfolios and sites built with generators such as Hugo or Astro belong here.
- Single-page application: a React, Vue or Svelte app is also static after you run its build command, which produces a folder such as dist or build. You deploy that folder, not your source code.
- Dynamic site: code that runs on the server for every request, for example a Node.js or Python backend with a database. Free options are limited; some put idle apps to sleep, so the first visit can be slow.
Choose a free host
- GitHub Pages: publishes a site directly from a GitHub repository. It is free for public repositories.
- Netlify: lets you drag and drop a folder onto its website or connect a repository, and creates a preview link for every change.
- Cloudflare Pages and Workers: fast global delivery and a very generous free allowance for static files.
- Vercel: popular for Next.js and other frameworks; its free Hobby plan is meant for personal, non-commercial projects.
All of them give you a free subdomain, such as your-name.github.io or your-site.netlify.app, and HTTPS without extra work.
Step by step: publish with GitHub Pages
- Prepare the files. Make sure the home page is called index.html and sits at the top of the folder.
- Create a repository. On GitHub, create a public repository. If you name it exactly your-username.github.io, it becomes your main user site; any other name creates a project site at your-username.github.io/repository-name.
- Upload the files. Push them with Git, or use Add file and Upload files in the browser if you do not use Git yet.
- Turn on Pages. Open Settings, then Pages. Under the source, choose Deploy from a branch, select main and the root folder (or /docs), and save.
- Wait and visit. After a minute or two, GitHub shows the address of your live site. Every new push to the branch updates it automatically.
If your site needs a build step, choose GitHub Actions as the source instead; GitHub suggests ready-made workflows for common generators.
Deploying from a build: the settings that matter
On Netlify, Cloudflare or Vercel, you connect the repository and enter two values: the build command, such as npm run build, and the output directory, such as dist. The service then rebuilds and publishes the site after every push. Checking these two fields solves most failed first deployments.
Add a custom domain (optional)
A free subdomain is fine for learning, but a domain such as yourname.com looks more professional. Domains are not free; expect to pay a registrar roughly 10 to 20 US dollars a year. In your host's settings, add the domain, then create the DNS records it shows you at your registrar, usually a CNAME record for www and A records for the bare domain. DNS changes can take from minutes to several hours. Finally, enable Enforce HTTPS so visitors always get a secure connection.
Common mistakes
- Wrong file name case: servers are usually case-sensitive, so Logo.PNG and logo.png are different files, even if your computer treats them as the same.
- Broken paths on project sites: a link to /css/style.css points to the root of github.io, not to your repository folder. Use relative paths such as css/style.css, or set your framework's base path.
- Deploying the source instead of the build: an empty page often means the host is serving the wrong folder.
- 404 errors on refresh: single-page apps need a rule that sends every route to index.html; each host documents how to add it.
- Secrets in the repository: API keys in a public repository, or in front-end code, are visible to everyone. Never commit them.
Limits, rules and good habits
Free plans have fair-use limits. GitHub Pages, for example, recommends keeping a site under 1 GB and has a soft bandwidth limit of 100 GB a month. Read each provider's terms: GitHub Pages is not intended for online shops, and Vercel's Hobby plan excludes commercial use. If you add analytics or a contact form, you may need a privacy notice, especially for visitors in the EU. Keep your project in Git so you can roll back a bad update. Once your first site is live, publishing the next one takes only minutes.