❯
❯
How to Host a Website for Free on GitHub Pages (Free SSL + Custom Domain)
Updated5 min read

How to Host a Website for Free on GitHub Pages (Free SSL + Custom Domain)

Host your website free on GitHub Pages: create a repository, upload index.html, turn on Pages, then add a custom domain and free SSL. Step-by-step with screenshots and live demos.
Free website hosting on GitHub Pages with a free github.io address, free SSL and custom domain

Categories

Categories

On this page

Quick answer

To host a website for free on GitHub Pages: create a free GitHub account, make a new public repository, upload your website with the home page named index.html, then go to Settings > Pages, choose Deploy from a branch, select main and /(root), and click Save. In a minute or two your site is live at username.github.io/repository-name with free HTTPS. You can add your own domain later under Custom domain.

Paying for hosting every month makes little sense for a simple website. If your site is plain HTML, like the pages made with Teasoft’s free AI Website Builder, GitHub Pages can host it for free, with a free address, a free SSL certificate and fast loading.

We followed every step below to publish two real demo websites. Open them to see the result: adbindra.github.io/brightsmile-dental-demo and adbindra.github.io/ironpeak-fitness-demo.

Demo gym landing page made with the AI Website Builder and hosted free on GitHub Pages
A gym landing page hosted free on GitHub Pages, with HTTPS.

What You Get Free with GitHub Pages

FeatureWhat you get
HostingFree for public repositories on a free GitHub account
Free addressusername.github.io or username.github.io/repository-name
SSL (HTTPS)Free and automatic on github.io, and free for custom domains too
Custom domainConnect a domain you own, such as yourbusiness.com, and change it any time
SpeedStatic HTML has no database or server code, so pages load fast
UpdatesUpload a new file and your site updates automatically

GitHub Pages Limits and Rules

GitHub Pages is generous for small websites, but it has limits worth knowing before you start:

  • Static sites only: HTML, CSS, JavaScript and images. No PHP, databases or WordPress.
  • Size: published sites can be up to 1 GB, and repositories are recommended to stay under 1 GB.
  • Bandwidth: a soft limit of 100 GB per month, far more than a small business site uses.
  • Builds: a soft limit of 10 builds per hour.
  • Public repository: on a free account, the repository must be public, so anyone can see your site’s code.
  • Not for online shops: GitHub says Pages isn’t meant to run an online business, e-commerce site or SaaS. It’s ideal for portfolios, landing pages, demos, event pages and small information sites.
Great for
  • One-page business websites
  • Landing pages and portfolios
  • Free SSL and custom domains
  • Sites that rarely change
Not for
  • Online stores and payments
  • WordPress or PHP sites
  • Private code on a free plan
  • Saving form data on the server

Step 1: Build Your Website and Download It

If you don’t have a website yet, create one free in a few minutes with the AI Website Builder. Our guide on how to build a free website with AI walks through every step. When you’re happy with it, click Download and choose either:

  • HTML file: rename it to index.html before uploading.
  • ZIP website package: unzip it on your computer. It already contains index.html, robots.txt and sitemap.xml.
  • Copy HTML code: paste it straight into GitHub in Step 4, with nothing to download.
Download options: HTML file, ZIP website package, copy HTML code, open in a new tab or save as PDF
Download your website as an HTML file or ZIP, or copy the HTML code.
Important: your home page must be named exactly index.html (lowercase) and sit at the top level of the repository, not inside a folder. Otherwise you’ll see a 404 page.

Step 2: Create a Free GitHub Account

Go to github.com and sign up with your email. Choose your username carefully: it becomes part of your free website address, for example adbindra.github.io. The free plan is all you need.

Step 3: Create a New Public Repository

A repository (or “repo”) is a folder for your website on GitHub. Click the + icon at the top right and choose New repository.

  1. Repository name: use a short, readable name such as brightsmile-dental-demo. It becomes part of your address.
  2. Description: optional, one line about your site.
  3. Visibility: choose Public. Free accounts can only publish Pages sites from public repositories.
  4. Click Create repository.
Creating a new public repository on GitHub for a free website
Step 3: create a public repository for your website.
Want the shortest free address? Name the repository exactly username.github.io, using your own username. Your site then opens at https://username.github.io with no folder name after it. You get one of these per account; every other repository uses username.github.io/repository-name.

Step 4: Upload Your Website Files

Your new repository is empty. Under Quick setup, you’ll see two links: creating a new file and uploading an existing file.

A new empty GitHub repository with links to create a new file or upload an existing file
Step 4: choose “uploading an existing file” or “creating a new file”.

Option A: Upload files (HTML file or ZIP)

  1. Click uploading an existing file.
  2. Drag index.html (and robots.txt and sitemap.xml if you used the ZIP) into the box. Drag the files themselves, not the folder they are in.
  3. Click Commit changes.

Option B: Paste the HTML code

  1. In the AI Website Builder, click Download > Copy HTML code.
  2. On GitHub, click creating a new file.
  3. Type index.html as the file name, then paste the code into the editor.
  4. Click Commit changes, then Commit changes again in the popup.
Adding index.html to a GitHub repository by pasting the website HTML code
Option B: name the file index.html and paste your website code.

Step 5: Turn On GitHub Pages

  1. In your repository, click Settings, then Pages in the left menu.
  2. Under Build and deployment, set Source to Deploy from a branch.
  3. Under Branch, choose main and / (root).
  4. Click Save.
GitHub Pages settings: Deploy from a branch, main branch, root folder, then Save
Step 5: publish from the main branch and the root folder.

Step 6: Open Your Free Website

GitHub builds your site in the background. After a minute or two, refresh the Pages settings and you’ll see Your site is live at with your address and a Visit site button.

GitHub Pages shows Your site is live with the free github.io address
Step 6: your website is live with a free github.io address.

Your free address depends on the repository name:

Repository nameFree website address
username.github.iohttps://username.github.io/
brightsmile-dental-demohttps://username.github.io/brightsmile-dental-demo/
Any repository with a custom domainhttps://www.yourbusiness.com/
Demo dental clinic website made with the AI Website Builder and hosted free on GitHub Pages
Our dental clinic demo, live on GitHub Pages.

Step 7: Add a Custom Domain to GitHub Pages

The free github.io address works well, but your own domain, such as yourbusiness.com, looks more professional and is easier to remember. GitHub Pages lets you connect a domain you own for free. Buy a domain from any registrar, then follow these steps.

1. Verify your domain (recommended)

Verifying stops anyone else from using your domain on GitHub. Click your profile picture, then Settings > Pages > Add a domain. GitHub shows a TXT record named like _github-pages-challenge-username.yourbusiness.com. Add it at your domain registrar, wait for it to update, then click Verify. Keep the TXT record in place afterwards.

2. Enter the domain in the Custom domain field

In your repository, go to Settings > Pages. Under Custom domain, type your domain (for example www.yourbusiness.com or yourbusiness.com) and click Save. GitHub adds a file named CNAME to your repository with your domain in it; leave that file in place. Add the domain on GitHub before you change your DNS.

GitHub Pages custom domain field and Enforce HTTPS setting for free SSL
Step 7: type your domain under Custom domain and click Save.

3. Point your DNS to GitHub

At your domain registrar, open the DNS settings and add these records:

TypeName / HostValue
A@185.199.108.153
A@185.199.109.153
A@185.199.110.153
A@185.199.111.153
AAAA (optional, IPv6)@2606:50c0:8000::153, 2606:50c0:8001::153, 2606:50c0:8002::153, 2606:50c0:8003::153
CNAMEwwwusername.github.io (your username, without the repository name)

Remove any old A records for @ that point to another host. DNS changes can take up to 24 hours. When they finish, GitHub shows a check mark next to your domain, and both yourbusiness.com and www.yourbusiness.com open your site.

Avoid wildcard records such as *.yourbusiness.com. GitHub warns they can let someone else take over your subdomains.

4. Change or remove your domain later

To switch to a different domain, type the new one in Custom domain, click Save and point the new domain’s DNS to GitHub as above. To go back to the free github.io address, click Remove. Your website files stay the same either way.

Step 8: Turn On Free SSL (HTTPS)

On a github.io address, HTTPS is already on and can’t be turned off. With a custom domain, GitHub requests a free certificate from Let’s Encrypt once your DNS is working. When it’s ready, tick Enforce HTTPS in Settings > Pages so every visitor gets the secure version.

If Enforce HTTPS stays greyed out for a long time, your DNS may still be updating. If it’s still stuck after DNS has finished, remove the custom domain, add it again and click Save to restart the certificate.

How to Keep Your Free Website Fast

  • Use small images. Compress photos to WebP or under 200 KB with our free image converter and compressor before uploading them.
  • Upload images to your repository. Put photos in the repo and link to them, so they load from the same fast server as your page.
  • Keep it to one HTML file where you can. AI Website Builder pages already include all CSS inside index.html.
  • Always link with https:// so browsers don’t block images or scripts as mixed content.

How to Update Your Website Later

Edit your page in the AI Website Builder (use Open last page), then upload the new index.html to the same repository with Add file > Upload files. Uploading a file with the same name replaces the old one. You can also open index.html on GitHub, click the pencil icon, edit and commit. Changes usually appear within a few minutes; refresh with Ctrl+F5 (Cmd+Shift+R on Mac) if you still see the old version.

SEO After Publishing

  1. Add a canonical link in index.html pointing to your final address (github.io or your domain).
  2. Update sitemap.xml with your real address and submit it in Google Search Console.
  3. robots.txt only works at the root of a domain. It’s read on username.github.io or your custom domain, but not inside a repository folder like /brightsmile-dental-demo/.
  4. Add your website to your Google Business Profile and social profiles.

For AI search engines too, see how to get your website found in ChatGPT, Gemini and Google AI Overviews.

Troubleshooting

ProblemFix
404 “There isn’t a GitHub Pages site here”Wait 1 to 2 minutes after saving. Check that the file is named index.html and sits at the top level, and that Pages uses main and / (root).
Old version still showingWait a few minutes, then hard refresh with Ctrl+F5 or Cmd+Shift+R.
Images not loadingCheck file names match exactly, including capital letters, and that links use https://.
Enforce HTTPS greyed outDNS is still updating. Wait up to 24 hours, then remove and re-add the custom domain.
Custom domain not workingCheck the four A records and the www CNAME, remove old A records that point elsewhere, and make sure the CNAME file is still in your repository.

Live Demos Hosted on GitHub Pages

Brightsmile Dental Studio

One-page websiteFree github.io domainFree SSL

IronPeak Fitness

Landing pageFree github.io domainFree SSL

Frequently Asked Questions

Is GitHub Pages really free?

Yes. GitHub Pages is free for public repositories on a free GitHub account, including a github.io address and HTTPS. You only pay if you buy your own domain name from a registrar.

How do I host a website on GitHub for free?

Create a public repository, upload your website with the home page named index.html, then go to Settings, Pages, choose Deploy from a branch, select main and / (root) and click Save. Your site goes live at username.github.io/repository-name.

Does GitHub Pages give free SSL?

Yes. github.io sites use HTTPS automatically. For a custom domain, GitHub gets a free Let’s Encrypt certificate once your DNS is set up, and you can tick Enforce HTTPS in Settings, Pages.

How do I add a custom domain to GitHub Pages?

In your repository, go to Settings, Pages, type your domain under Custom domain and click Save. Then, at your registrar, add four A records for the root domain (185.199.108.153, 185.199.109.153, 185.199.110.153 and 185.199.111.153) and a CNAME record for www pointing to username.github.io. You can change to a different domain later.

How long does it take for a GitHub Pages site to go live?

Usually a minute or two after you save the Pages settings. A custom domain can take up to 24 hours while DNS updates.

Can I host a business website on GitHub Pages?

A simple information or landing page for a business is a common use. GitHub says Pages isn’t intended for running an online business, e-commerce or SaaS, so use a paid host for online stores and payments.

Can I host WordPress on GitHub Pages?

No. GitHub Pages only hosts static files such as HTML, CSS, JavaScript and images. It can’t run PHP or databases, so WordPress needs regular web hosting.

Why does my GitHub Pages site show a 404 error?

Usually the home page isn’t named index.html, it’s inside a folder, or the site is still building. Check the file name and location, confirm Pages is set to main and / (root), and wait a minute.

How much traffic can GitHub Pages handle?

GitHub Pages has a soft bandwidth limit of 100 GB per month and a 1 GB site size limit, which is plenty for a small business website or landing page.

No website yet? Make one free in a minute

Describe your business and the AI Website Builder creates a complete landing page or one-page website, ready to host on GitHub Pages.

Amandeep Bindra
Written by

Amandeep Bindra

Founder, AdBindra Corporation

Amandeep Bindra is the Founder of AdBindra Corporation, the parent company of Teasoft. With over a decade in web development, AI and digital marketing, he shares practical, tested insights on AI tools, web technology and productivity.

Found this useful? Share it