Free hosting on GitHub with GitHub Pages!

Learn to host your website for free on GitHub with GitHub pages.

Harsh Prateek
3 min readApr 27, 2022
Photo by Di_An_h on Unsplash

There are loads of benefits of having your website on the internet. Be it for showcasing your talent to a potential client, position yourself as an expert in your field, or maybe just to share your thoughts on anything over the internet.

In this article, I will tell you how you can make free hosting for yourself. You would also get a domain name for free, although I would recommend having a custom domain name if you want to use it for commercial purposes. Let's begin!

Introduction, what is GitHub and GitHub pages

1:) What is Github:

GitHub is a code-sharing platform based on Git. It enables devs from all across the globe to share, review and make changes to the code-base. I wrote an article about how to get started with Git and GitHub. If you want to move further in this article then I would recommend first reading this article in case you don’t know how to use Git and GitHub.

2:) What is GitHub Pages:

It is a free service of GitHub that enables the devs to show the Working website with all its frontend features. GitHub provides server space and a domain name for free. You can also use your custom domain name if you like that.

How can you use it :

Create a repo on GitHub, and commit your HTML, CSS, and JavaScript as I did in this article. After doing all this, you will see this page on your repo

Image of the github repo page

Click on the settings tab, and scroll to the bottom of the page. This screen will appear:

image of the settings page

Click on the pages icon and choose the branch which has your HTML file. Remember that your main HTML file should not be in any folder and should be directly inside the branch.

Choose the branch and choose root in the other dropdown. The page should look like this:

Click on the link and enjoy your website which you must have tirelessly worked on. Now, you can show your website to anyone with this link and from now on, any changes you would do to this repo would instantly be reflected on this site.


This was the way you can host your site for free on GitHub pages. Remember that it can only hold frontend sites and not the ones which require a backend. For that, you have to rent a server.

If you like this article then please follow me on Twitter where I post about web development and here on Medium where I post about coding and web development. I hope you enjoyed this article😊.



Harsh Prateek

Hi, I am Harsh and I write about coding and learning techniques. I am a student myself and would love to tell everyone my secrets for coding and learning.