While most PC users don’t ever encounter a need of modifying their computer’s hosts file, there’re some like you who do. Before we dive into the process of modifying this important system file, let’s learn a bit about it so you can make sense of what you’re doing and what will be its effects. Hosts file is basically a text file buried deep inside your computer’s Windows folder, but you won’t find a .txt extension next to its name. You can see the file by navigating to the path given below:
The size of original file tends to be around 824 bytes. The role of this file in your system is to map user-friendly hostnames (i.e. www.hostname.com) to their respective IP addresses so you can browse the internet. If you block a website inside this file, you won’t be able to browse it anymore. This can be used perfectly to block access to any websites that you don’t want to visit, especially in a networked environment where multiple PCs and users exist (i.e. workplaces).
Introduction done, and now you’re familiar with this new friend, right? Now let’s learn how to deal with Windows 10 hosts file:
Locating the Hosts file in Windows 10
As I said above, you can navigate to C:\Windows\System32\Drivers\etc to find your Windows 10 hosts file. You can see it in the image given below:
Now when you’ve found it, let’s look at how can you modify it.
Editing the Windows 10 Hosts file
Before you can edit this file, there’re two pre-requisites that need to be done:
- Make sure that your account has Administrator privilege as only administrators can modify this file.
- Disable your antivirus software temporarily.
Once you’re done with these things, right-click the file and open it with notepad.
Now you can perform various actions given below according to your requirements:
Blocking a site on Windows 10 using Hosts File
If you want to block access to any particular site, you can simply add its entry in the end of the file like this:
127.0.0.1 blocksite.com (where blocksite.com is the url that you want to block).
Once you’ve made the necessary changes, you can hit Ctrl+S on your keyboard to save the file.
Unblocking a site
Unblocking a blocked site is as simple as you may assume – just open your hosts file in Windows 10 with notepad, delete the entry of URL that you want to unblock and hit Ctrl+S.
Locking Windows 10 hosts file
Sometimes viruses or adware programs may intend to affect your hosts file to redirect you to malicious websites. Imagine firing www.facebook.com in your browser’s address bar but landing on any other malicious website! Seems horrible even in thoughts, right? This is called Hosts File Hijacking in cyber community.
There’re two ways to prevent that from happening with you – one is, as you know already, installing a good antivirus software and keeping it updated. But if you want to add another layer of security then second option is to lock the hosts file so no other program or user except you can rewrite to it without unlocking it. To do so, right-click the file, click on Properties in the bottom of the menu and make it a Read only file by checking its checkbox in the Properties dialog box. Once checked, hit the OK button.
Well, this was all about locating, editing and managing your system’s hosts file in Windows 10. Now you may wanna try the steps given here, but follow the steps carefully otherwise your entire internet connection may become “dumb.” If you have any questions related to Windows 10 hosts file, feel free to drop a comment below.