Technically yes, but in your case most probably No. The fact that you are asking the question can I build a website before hosting indicates that your concept about the website, it’s hosting, and other fundamental concepts are not clear yet. The below explanation will help you graduate this seemingly mysterious concept of website making process.
How Is A Website Built?
A professional website is built in two parts. The first part is the design of the website, the second part is making that design functional which is done through coding. Once both parts are done you can say that the website package is ready.
What Is A Website Package?
The website package is a web designed and coded which is ready to be deployed.
You are probably not a designer and can skip the design part by hiring a designer from a freelance platform to design the website or you can even buy a complete package from web market places like ThemeForest. These platforms allow you to buy ready-made website packages that are built on dummy content, all you have to learn is to how to install the website package.
Either way, if you get a premade website package from ThemeForest or have a custom website done with design and coding you still need to have the website package built. Building means to deploy or install the website package somewhere and that is through hosting.
Where do I install the Website Package?
You can install the package at your computer through servers such as XAMPP or you can deploy it on the server of some hosting service providing companies such as SiteGround.
Either way, you need hosting to build the website. The hosting can be your own computer or some other service provider. It would be interesting to depict this in the form of a simple equation.
Website Building = Design + Coding of the design + Deployment of coded design (hosting)
Hosting = Your own computer as server OR Some hosting service provider.
Can I Host Website On My Own Computer?
Yes, you can do that but this would be a big steep curve of understanding that concept of server deployment. You would have to make sure that your computer remains turned on 24/7, make the server secure, allow the incoming traffic, manage the network bottlenecks. That would be too much of a hassle when you can actually get hosting at the very cheap price these days from renowned platforms like SiteGround.
It would be a good learning experience but certainly not worth it exercise.
What is Local Hosting?
Local hosting as the name implies is hosting the website on your own computer. It does not mean to host the website in your local city hosting service provider. Local hosting is a good way to properly build an error-free website on your end and then upload it to the hosting service provider that can be located on any part of the website.
Why Did you say Technically Yes in the Beginning?
If you are someone who just wants to practice the art of website building, then you can make your own computer the local host of your website. The finished products would be deployed on your own computer and will be accessible to only yours.
Yes, you will have a fully functional website but the problem would be that it is only for you and the concept of a website that is worldwide would just lose its purpose. So for aspiring developers, this is a good idea to build your website before hosting on the local computer but if you are providing this service to someone else you will definitely need to host the website on hosting providers.
How do Professional Companies Build Websites?
Professional companies have teams of designers and developer, if they are making a website from scratch they make it totally on their own servers locally.
If these companies are working on somebody else’s website improvement. They usually first download the whole website then host it locally on their own servers. So they have a version of a website that is only accessible to them. After doing changes on the website, making sure the requirements are fulfilled they would simply upload the website to the client’s server.
How did you build this website?
I downloaded the website package and installed it on a hosting service provider. So I had to buy hosting before building this website. After having a bad experience with the company I hosted the website on I switched to SiteGround. Ever since I have smooth website management experience.
After installing the package, I altered the content to make it look like how I wanted it to be. After the bad experience, I took technical assistance from SiteGround to transfer my website package from my previous hosting to their own. They transfer process was done with in one day and the website package was done correctly. Hence this website package is built on SiteGround hosting.
I hope the above examples, analogies and simple explanation helped you understand why you need hosting before you can build your website. If the definition of website building is flexible and the goal is to build a website for practice then you can host your website locally if your goal is to make professional clients, or work for a client then you will definitely need hosting before you build the website.