In this article you will learn how to get free website hosting in 2021 using different platforms online. I will explain step by step about each platform and I will also tell you about the best options according to your needs. And, keep one thing in mind that the resources mentioned below are not the only resources but these are the ones I use and will be telling you about. So, without wasting time let’s get into it.
Why do you need a free web hosting?
In your development career you might come across to a point where you need to test your site’s performance online and check if it is working fine on the internet. You may want to test the website for yourself or maybe you are a freelancer and you want to show your website to a client as a working demo, this article covers everything.
Now, to host your website there are a couple of options, they all provide different features and services and you can select the platform according to your needs. Here is the list of all the platforms I use for free website hosting and will be covering in this article:
Free website hosting using Heroku.com

It is one of the platforms that offer free website hosting. This platform is great for beginners who want to test their websites on the internet. It is simple and provides many options to manage your site. It also provides collaboration to github, which means that users can directly update their website as soon as they commit their code on their github repository.
How to use it?
First of all you have to create an account on heroku. If you already have an account then you can sign in directly. In the heroku dashboard click on the “create a new app” button. Fill in the necessary details and make to download the heroku cli from their website.
After that you have to open up your terminal or command prompt and type the following command.
heroku login
This will take you to the Heroku’s website’s login page, go ahead and fill your login credentials and hit sign in. Then you can go back to your command prompt or terminal and type the following commands one by one.
git init git create heroku mywebsite git add . git commit –am “first commit” git push origin master
Note if you have an html app then you have to make a separate PHP file in your root directory and type the following code in that file.
index.php
<?php header(“Location: index.html”);
You have to provide the location of the index.html file in the header function in php.
Free website hosting using Infinityfree.net

This service provides free domain and database support along with free website hosting, it has a cpanel in it and you can easily modify your website. Just register yourself to infinity free and you will be good to go.
If you have registered yourself then you can proceed to the domain section. You can use a free subdomain or a custom domain it is up to you.
Free website hosting using Netlify.com

This is one of the easiest ways to get free website hosting. Like heroku this service also provide collaboration with github and some other repository hosting services. Moreover, it also has a pretty good user experience and user interface.
Note that this service is only useful if you have a static website and you might have to purchase some other services to be able to host a dynamic website that has backend in it.
There are three ways to host a website on netlify:
- Drag and drop files from your device
- Use git
- Use CLI
Deployment using netlify CLI
First of all you have to make sure you have npm installed in your device. To check that open your command line and type the following command:
npm –version
If you have npm installed then you will see a version number otherwise you will see an error message that says:
After that first of all go to the root directory of your project by using “cd [directoryname]” in command line now you have to type the following commands:
npm install netlify-cli npm deploy
And your site will be deployed to netlify and you can visit it by the url given in the command line.