Select Page

Blocking websites in your PC – No software required

Do you want to block any websites in your PC ? Here is the simple way that don’t need any Antivirus, firewall or any other software.


In every PC, it may be Windows, Linux or Mac, there will be a file called HOSTS. We are going to use this file to block or redirect the websites somewhere.


Like any other file in your system, hosts is a file used by the Operating system. It is used to map a hostname or website to an IP address.

In other words, when you type “” in your browser, your computer will check the hosts file to see if there is any IP address defined for that hostname ( If there is no entry found for the hostname (, then the computer will request the IP address of to DNS (Domain Name System) servers.

In most of the case, this hosts files will not have any manual configuration in it. So, every time when you browse any website, your computer will ask DNS servers for the IP address. This method of defining IP address for a website or hostname is called as LOCAL DNS method.


In Windows, the file will be located at the following location.



You can also open this file using RUN utility in Windows.

Windows Key + R  >> Type “drivers” and Press OK


It will take you to the ‘Drivers’ folder where you can see the folder called ‘etc’.Hosts will be inside that ‘etc’ folder.

In Linux machine, open terminal and the file will be located at,


In Mac machine, the file will be located at the following location.


In Windows, you can edit this file by opening in Notepad, Notepad++, Wordpad or any other text editors. In the same way you can edit this file in Linux and Mac using any editors like vim, nano etc.,


Just open this hosts file as Administrator and enter the following at the end of the file to block


Now Save this file. Please note that, you need administrator privilege to save this file. Now try accessing or in any browser in your system. You will get the error that “The webpage is not available”.

not availableLike this, you can block any number of websites in your PC. All you have to do is, enter the website name as given below in the hosts file.

 How redirect a website?

 If you don’t want to block the site and you wish to redirect the website to another site, you can use this method. Let me explain in detail. If you want to redirect to, the entries in the hosts file should be modified little. Very little. 

To redirect to, we need the IP address of You can get the IP address of using a simple command called ping.

Just execute the following command in command prompt (Windows) or terminal (Linux and Mac).


You will get an similar output as shown in the image below.


The IP address which is marked in yellow colour is the IP address of

Now paste the following entry in hosts file to redirect to

That’s it. It is done. Now try accessing in your browser. You can see it redirecting to Likewise, you can redirect any website to any other website. Also, you can block any website. No need of firewall, antivirus or any other software.

Hope you enjoyed this post..!

About The Author

It's me, Nivas Baskaran , a product of the 90's living in Bangalore. This is my personal blog and I'm here to post some cool stuffs. I love spending time with my Friends. Jovial in nature. I love Tea/Coffees. Ping me to know more about me :P

Leave a reply

Your email address will not be published. Required fields are marked *

Subscribe for Updates

Like Us on Facebook