How to Find and Edit the Hosts File in Windows 11

There are numerous ways to find the IP address in Windows 11, but what if you want to find and edit the hosts file in Windows 11? The hosts file is a powerful method to restrict or allow a certain website on your PC. It allows you to add an IP address for a particular domain, and the browser will point to that specific address. So we have put together a nifty guide on how to find and edit the hosts file in Windows 11. Moreover, we have included an explainer of what the hosts file does in Windows 11, so you can grasp the concept in easy terms. On that note, let’s move to the steps you need to follow.

Find and Edit Hosts File in Windows 11 (2022)

We have mentioned the location of the hosts file in Windows 11 in this guide, so you can edit it with ease. Moreover, we have also explained what is the hosts file and what is its use on your Windows 11 PC.

What is the Hosts File in Windows 11?

When you open a website on your PC, the browser looks for the IP address of the domain name from a DNS server. However, before that, it goes to the “hosts” file on your Windows PC first to find if the user has specified an IP address for a particular domain. If you have specified a website to a non-existent IP (such as 0.0.0.0), the website won’t open and will effectively be blocked. In essence, the hosts file keeps a list of all the websites that you have blocked on your PC.

Having said that, if you are using one of the popular DNS servers in your browser, the browser will ignore the hosts file. It will directly go to the DNS server or DNS cache to fetch the IP address of the website (domain name) you visit. To avoid this situation, we will suggest enabling DNS over HTTPS (DoH) on Windows 11 from the system settings. It will ensure that you get all the encrypted protection of DoH while also taking the hosts file into account. In this scenario, the websites mentioned in the hosts file will be blocked, and you will also get encrypted DNS communication.

So, to sum up, the hosts file in Windows 11 allows you to block websites by pointing them to a made-up IP address. It’s an easy and effective solution for users who want to restrict certain websites on their PC, from all browsers.

How to Find the Hosts File in Windows 11

1. First, press the Windows 11 keyboard shortcut “Windows + E” to open the File Explorer. Here, double-click to open the “C” drive.

2. Next, move to the “Windows” folder.

3. After that, navigate to system32 -> drivers -> etc folder. Here, you will find the “hosts” file that we need to edit. It will be a “File” type and not “Calendar”.

4. If you don’t see the “hosts” file in this folder, click on “View” in the top menu and click on “Show”. Now, choose “Hidden items“. This will show all the hidden items, including the “hosts” file.

Windows 11 Hosts File Location

You can navigate to the following address – “C:\Windows\system32\drivers\etc” to find the hosts file on Windows 10 and 11. While you need admin permissions to edit the hosts file at its original location, we will take a slightly different route here. So keep reading.

How to Edit the Hosts File in Windows 11

1. First, make a copy of the “hosts” file to a different location, like the Desktop. It will allow you to edit the Hosts file in Windows 11 with ease and without admin privileges.

2. Now, move to the copied hosts file, right-click on it and choose “Open With”. Here, select “Notepad“.

3. To block websites using the “hosts” file in Windows 11, add a line at the bottom by following the below syntax. Here, you are pointing twitter.com to 0.0.0.0, which is a non-existent IP address. The sentence after # is a comment, and it’s optional. You can add as many websites to the hosts file as you want using the below syntax.

0.0.0.0 twitter.com #Your PC will block twitter.com

4. Now, click on “File” in the top menu and choose “Save“.

5. After that, copy and move the modified “hosts” file to the “etc” folder to replace it. It will ask for administrator permission, and you need to click on “Continue“.

6. Finally, go ahead and open twitter.com, and it won’t open on your Windows 11 PC since the IP address for this website is mapped to a non-existent IP address. So that is how you can find and edit the hosts file in Windows 11 to block websites.

7. In case you want to unblock the website, simply remove the line you added in the hosts file or add # in the beginning of the line to turn the whole text into a comment. This will make the command ineffective. Now, move the modified hosts file to the “etc” folder again to have the changes take effect.

Frequently Asked Questions (FAQ)

What is the Hosts file in Windows 11?

The hosts file essentially contains a list of websites you want to block on your PC. You can also use the hosts file in Windows 11 to point a domain name to a particular IP address.

Where to find the Hosts file in Windows 11?

The hosts file in Windows 11 is located at C:\Windows\System32\drivers\etc .

What is the use of the Hosts file in Windows 11?

You can use the hosts file in Windows 11 to block websites on your PC by pointing them to a non-functional IP address.

Can we enable DNS over HTTPS with a Modified Hosts file?

Yes, you can use DNS over HTTPS and route traffic to the ghosts file at the same time. However, you need to enable DNS over HTTPS from Windows Settings and not through the browser.

Edit the Hosts File to Block Websites in Windows 11

So that is how you can locate and edit the hosts files in Windows 11. Reiterating again, if you want your PC to look for blocked hosts on your Windows PC, you will have to disable DNS over HTTPS from your browser. And if you have enabled DNS over HTTPS from the PC settings, you don’t need to do anything. Windows 11 will take the hosts file into account. Anyway, that is all from us. If you want to find the Windows 11 Startup folder in Windows 11, use our linked guide. And to find your MAC address in Windows 11, we have a handy guide for that as well. Finally, if you have any questions, let us know in the comment section below.

#Tags
Comments 0
Leave a Reply