- The hosts file location on Windows 11 and 10 is "C:\Windows\system32\drivers\etc".
- You can move to the mentioned path and edit the hosts file to block or allow certain websites on your Windows PC.
- Note that if you are using a DNS server, the hosts file configuration will be ignored.
The hosts file on Windows is a powerful method to restrict or allow certain websites 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 complete guide on how to find the hosts file location in Windows 11 and 10. Moreover, we have included a guide on how to edit hosts file and explained what the hosts file does in Windows.
Hosts File Location in Windows 11 and 10
You can navigate to the following address C:\Windows\system32\drivers\etc
to find the hosts file location on Windows 11 and 10. 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.
What is the Hosts File in Windows?
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 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.
2. Here, double-click to open the “C” drive.
3. Next, move to the “Windows” folder.
4. After that, navigate to system32 -> drivers -> etc folder.
5. Here, you will find the “hosts” file that we need to edit. It will be a “File” type and not “Calendar”.
6. If you don’t see the “hosts” file in this folder, click on “View” in the top menu and click on “Show”.
7. Now, choose “Hidden items“. This will show all the hidden items, including the “hosts” file.
How to Edit the Hosts File in Windows 11 and 10
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, right-click on the copied hosts file, 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, for example, I am 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.
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.
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.
The hosts file in Windows 11 is located at C:\Windows\System32\drivers\etc
.
You can use the hosts file in Windows 11 to block websites on your PC by pointing them to a non-functional IP address.
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.