Can I build a website before purchasing web hosting?

Can I build a website before purchasing web hosting?

What are the benefits of using localhost?
Having a staging set up on your own computer is very beneficial for testing. The reality is that it’s best to perform updates to WordPress core files and plugins and themes in a staging environment so as not to risk crashing your live site in the event that an update breaks your set up. It’s a great place to try out new design ideas for your website without the risk of visitors seeing your changes before you have them perfected.