You can build a working website using only free tools — a code editor, a hosting service that costs nothing, and a browser
Building a website without spending money means choosing three things: where to write your code, where to store it online, and which free hosting service to use. The most common path is to write HTML and CSS in a free code editor like Visual Studio Code, store your files in GitHub (which is free), and then host the finished site on GitHub Pages or Netlify — both of which host static websites at no cost. This works for blogs, portfolios, small business sites, and documentation. It does not work for sites that need a database or user login system, because those require server-side code that free hosting does not support.
The trade-off is that you do the work yourself. You write the code, you fix the bugs, and you manage the files. You do not get a drag-and-drop builder or customer support. But if you are willing to learn HTML and CSS, the tools are genuinely free and the result is a real website that lives on the internet.
Key Takeaways
- Visual Studio Code is a free code editor where you write HTML and CSS, and it runs on Windows, Mac, and Linux.
- GitHub is a free service where you store your code files and version history, and it also offers free hosting through GitHub Pages.
- Netlify and Vercel are free hosting services that connect to your GitHub files and publish your site automatically whenever you update the code.
- You will need to buy a domain name separately (usually $10 to $15 per year) if you want a custom web address instead of a GitHub or Netlify subdomain.
- This approach works for static sites — blogs, portfolios, documentation — but not for sites that need user accounts or a database.
Set up a code editor on your computer
read and install Visual Studio Code from code.visualstudio.com. It is free, runs on Windows, Mac, and Linux, and is the most common editor developers use. When you open it, you will see a blank workspace. Create a new folder on your computer for your website project, then open that folder in Visual Studio Code by going to File > Open Folder.
Inside that folder, create a file called index.html. This is the home page of your website. Write basic HTML in it — a title, a heading, some text. Visual Studio Code will highlight your code in different colors to help you spot mistakes. Save the file. You can then open it in your browser by double-clicking it, and you will see your page rendered as a website.
As you build, you will create more files: a style.css file for colors and layout, maybe a script.js file for interactive features. All of these live in the same folder. This folder is your entire website.
Store your files in GitHub
GitHub is a free service where you store your code and track changes over time. Go to github.com and create a free account. Once you are logged in, click the plus icon in the top right and select "New repository." Name it something like "my-website" and leave it public so it can be hosted. Do not initialize it with a README yet — you will push your local folder instead.
On your computer, open a terminal or command prompt in your website folder. If you have never used Git before, read and install it from git-scm.com first. Then run these commands in order:
- git init — tells Git to start tracking this folder
- git add . — stages all your files to be saved
- git commit -m "Initial commit" — saves a snapshot with a message
- git branch -M main — renames your branch to main
- git remote add origin https://github.com/YOUR-USERNAME/my-website.git — connects your local folder to your GitHub repository (replace YOUR-USERNAME with your actual GitHub username)
- git push -u origin main — uploads your files to GitHub
Your code is now on GitHub. Every time you make changes, you run git add ., then git commit -m "description of change", then git push to upload the new version. This history is saved, so you can always see what changed and when.
Publish your site with GitHub Pages or Netlify
GitHub Pages is the simplest option if you are already using GitHub. Go to your repository on github.com, click Settings, scroll down to "Pages," and under "Source" select "Deploy from a branch." Choose the "main" branch and save. GitHub will then publish your site at username.github.io/my-website (or at username.github.io if your repository is named username.github.io). This happens automatically — every time you push new code, the site updates within seconds.
Netlify is an alternative that offers a slightly nicer interface and a few more features. Go to netlify.com, sign up with your GitHub account, and click "Add new site." Select "Import an existing project," choose your GitHub repository, and Netlify will build and host it for you. Your site will live at a Netlify subdomain like my-website-12345.netlify.app. You can change this to a custom domain later if you buy one.
Both services are free for static sites. The difference is mostly preference — GitHub Pages is built in, Netlify has a friendlier dashboard. Either one will work.
Connect a custom domain name
If you want your site to live at yourname.com instead of a subdomain, you need to buy a domain name. Services like Namecheap, Google Domains, and GoDaddy sell domains for roughly $10 to $15 per year. Once you own the domain, you point it to your hosting service by changing the DNS records.
For GitHub Pages, go to your repository Settings > Pages and add your domain under "Custom domain." GitHub will tell you what DNS records to create at your domain registrar. For Netlify, go to your site settings, click "Domain management," and add your custom domain — Netlify will guide you through the DNS setup.
DNS changes can take a few hours to propagate, so do not panic if your domain does not work when ready. Check back after an hour or two.
What you cannot do with free hosting
Free hosting services like GitHub Pages and Netlify host static sites — pages made of HTML, CSS, and JavaScript that run in the browser. They do not run code on a server. This means you cannot build sites that need user accounts, databases, or server-side processing.
If you need those features, you have two options. The first is to use a free tier from a service like Firebase or Supabase, which provide databases and authentication without a credit card. The second is to pay for hosting — services like Heroku, Railway, or traditional web hosts offer paid plans that start at a few dollars per month and support full-stack applications.
For most people starting out, a static site is enough. A blog, a portfolio, a documentation site, a landing page — all of these work perfectly on free hosting.
Frequently Asked Questions
Do I need to know how to code to build a website this way?
Yes, you need to learn HTML and CSS at minimum. There are many free tutorials online — freeCodeCamp, MDN Web Docs, and Codecademy all teach these languages for free. If you want interactive features, you will also need to learn JavaScript. The learning curve is real, but it is not steep if you are willing to spend a few weeks on it.
Can I use a website builder like Wix or Squarespace instead?
Yes, but they are not free. Wix and Squarespace offer free trials or limited free plans, but to publish a real site you pay monthly. If you want zero cost and do not mind learning code, the GitHub Pages route is cheaper. If you want a drag-and-drop builder and do not want to code, you will need to pay.
What if I want to add a contact form or newsletter signup?
You can use a third-party service like Formspree or Netlify Forms, which are free for small volumes. Formspree lets you create a form in HTML and it handles the submission. Netlify Forms works the same way if you are hosting on Netlify. Both send form submissions to your email.
How do I know if my site is actually live on the internet?
Open your browser and go to the URL where you published it — either your GitHub Pages URL, your Netlify URL, or your custom domain. If you see your website, it is live. You can also send the link to someone else and they should see the same thing.
What happens if I stop paying for my domain name?
The domain goes back on the market and someone else can buy it. Your site itself stays live at the GitHub Pages or Netlify URL, but the custom domain stops pointing to it. If you want to keep your custom domain, you need to renew it every year before it expires.