CodeWithAavi › Blog › Host a static website free on Vercel

Deployment 9 min read

How to Host a Static Website for Free on Vercel (Step by Step)

A static site (plain HTML, CSS and JavaScript) is the easiest kind of website to put online. This guide walks through publishing one on Vercel from a GitHub repository, connecting your own domain, and using vercel.json for clean URLs and redirects. It also covers the mistakes we made while running ShayariGarden on Vercel, so you can skip them.

Updated: October 2026

What you need before you start

  • A folder with an index.html file (and your CSS, JavaScript and images).
  • A free GitHub account and Git installed on your computer.
  • A free Vercel account (sign in with GitHub, it is the simplest option).
Check the plan terms first. Vercel's free Hobby plan is intended for personal, non-commercial projects. If your site earns money (ads, sales, sponsored posts), read Vercel's current terms and pricing before you rely on the free plan. Cloudflare Pages and Netlify are common alternatives for static sites. The steps below are almost the same on all of them.

Step 1: Put your project on GitHub

Open a terminal in your project folder and run:

terminal
git init
git add .
git commit -m "First version of my website"
git branch -M main
git remote add origin https://github.com/YOUR-USERNAME/YOUR-REPO.git
git push -u origin main

Create the empty repository on GitHub first (the green New button), then paste its URL in the git remote add line.

Step 2: Import the repository in Vercel

  1. In the Vercel dashboard choose Add New and then Project.
  2. Pick your GitHub repository and click Import.
  3. For a plain HTML site choose the Other framework preset. Leave Build Command and Output Directory empty so Vercel serves your files as they are.
  4. Click Deploy. After a short wait you get a free address like your-project.vercel.app.

From now on, every git push to the main branch publishes a new version automatically. Other branches get their own preview links, which is handy for testing changes.

Step 3: Connect your own domain

  1. Buy a domain from any registrar.
  2. In your Vercel project open Settings, then Domains, and add your domain (for example www.example.com).
  3. Vercel shows the exact DNS records to create. Add them in your registrar's DNS panel. Usually this is a record for the bare domain and a CNAME record for www.
  4. Wait for DNS to update (often minutes, sometimes a few hours). Vercel then issues the HTTPS certificate for you.

Choose one version as the main address, either example.com or www.example.com, and let the other redirect to it. Search engines should see a single address for each page.

Step 4: Clean URLs and redirects with vercel.json

Create a file named vercel.json in your project root. This example removes .html from addresses and permanently redirects an old address to a new one:

vercel.json
{
  "cleanUrls": true,
  "trailingSlash": false,
  "redirects": [
    {
      "source": "/old-page",
      "destination": "/new-page",
      "permanent": true
    }
  ]
}

permanent: true sends a permanent (308) redirect, which tells search engines to move the old address's ranking to the new one. Use false for a temporary redirect.

Step 5 (optional): Deploy from the command line

terminal
npm install -g vercel
vercel          # creates a preview deployment
vercel --prod   # publishes to your production domain

The first run asks you to log in and link the folder to a project. After that the two commands above are all you need.

Mistakes we made (so you can skip them)

  • Folder names are case-sensitive. Vercel runs on Linux, so /Shayaries/ and /shayaries/ are different addresses. A link that works on your Windows or Mac computer can return a 404 online. Keep one spelling and use it everywhere.
  • Old misspelled addresses kept getting traffic. We had pages indexed under addresses with typos and apostrophes. We fixed it with explicit, one-to-one redirects in vercel.json (about 90 of them) instead of wildcard rules.
  • Avoid redirect chains. Point each old address straight to the final one. A to B to C slows pages down and can make search engines drop the old address.
  • Use root-absolute links such as /coding/styles.css instead of ../styles.css. Relative paths break when the same page is reached through a different folder depth.
  • Check robots.txt. A stray Disallow line can stop search engines from following your redirects.

Quick checklist before you share your site

  • The home page and every important link open without a 404.
  • The site loads over https:// and the other domain version redirects to your main one.
  • Each page has its own title and meta description.
  • You submitted your sitemap.xml in Google Search Console.

Frequently asked questions

Is Vercel really free for a static website?

Vercel offers a free Hobby plan that can host static sites with HTTPS and automatic deployments from GitHub. The Hobby plan is meant for personal, non-commercial use, so read Vercel's current terms and pricing before using it for a site that earns money.

Do I need to know how to code to deploy a static site?

You only need a folder of HTML files, a GitHub account and about ten minutes. The steps above need Git for the first upload; after that, publishing a change is a single push.

How do I remove .html from my page addresses?

Add "cleanUrls": true to a vercel.json file in your project root. Then /about.html is served at /about, and Vercel redirects the old .html address to the clean one.

Why does my page show 404 on Vercel but work on my computer?

The most common cause is letter case. Vercel's servers treat /Folder/ and /folder/ as different paths, and your local computer may not. Make the link, folder and file names match exactly.

How long does a custom domain take to start working?

DNS changes often take a few minutes but can take several hours. Vercel shows the domain as valid once the records are found and then issues the HTTPS certificate automatically.