How to Find and Edit Hosts File in Windows 11 (2022)

There are many 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’ve put together a nifty guide on how to find and edit the hosts file in Windows 11. Additionally, we’ve included an explainer of what the hosts file does in Windows 11, so you can understand the concept in terms simple. On that note, let’s get to the steps you need to take.

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 change it easily. Moreover, we have also explained what the hosts file is and how to use it on your Windows 11 PC.

What is the Hosts file in Windows 11?

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

what is a hosts file in windows 11

That said, if you use one of the popular DNS servers in your browser, the browser ignore hosts file. It will go directly to the DNS server or DNS cache to retrieve the IP address of the website (domain name) you are visiting. To avoid this situation, we suggest enabling DNS over HTTPS (DoH) on Windows 11 from System Settings. This will ensure that you get all the encrypted protection of DoH while keeping the hosts file in mind. In this scenario, the websites mentioned in the hosts file will be blocked and you will also get encrypted DNS communication.

So, to sum it up, Windows 11 hosts file allows you to block websites by pointing them to a made up IP address. It is a simple and effective solution for users who want to restrict certain websites on their PC, from all browsers.

How to Find Hosts File in Windows 11

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

Find and Edit Hosts File in Windows 11 (2022)

2. Then go to “the Windows” case.

Find and Edit Hosts File in Windows 11 (2022)

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

Find and Edit Hosts File in Windows 11 (2022)

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

Find and Edit Hosts File in Windows 11 (2022)

Windows 11 hosts file location

You can access the following address – “C:\Windows\system32\drivers\etcto find the hosts file on Windows 10 and 11. Although you need administrator permissions to edit the hosts file in its original location, we’ll take a slightly different route here. So keep reading.

How to Edit Hosts File in Windows 11

1. First, do a copy of the “hosts” file to a different location, such as the office. It will allow you to edit Hosts file in Windows 11 easily and without admin privileges.

Find and Edit Hosts File in Windows 11 (2022)

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

Find and Edit Hosts File in Windows 11 (2022)

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

0.0.0.0 twitter.com #Your PC will block twitter.com
Find and Edit Hosts File in Windows 11 (2022)

4. Now click “File” in the top menu and choose “to safeguard“.

Find and Edit Hosts File in Windows 11 (2022)

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

admin permission

6. Finally, go ahead and open twitter.comand that will not open on your Windows 11 PC since the IP address of this website is mapped to a non-existent IP address. This is how you can find and edit the hosts file in Windows 11 to block websites.

website not accessible

7. If you want to unblock the website, all you need to do is delete line you added in the hosts file or add # at the beginning of the line to turn all the text into a comment. This will render the command ineffective. Now move the modified hosts file back into the “etc” folder for the changes to take effect.

to add #

Frequently Asked Questions (FAQ)

What is the Hosts file in Windows 11?

The hosts file basically contains a list of websites that 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 Hosts file for in Windows 11?

You can use the Windows 11 hosts file to block websites on your PC by pointing them to a non-working 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 ghost file at the same time. However, you must enable DNS over HTTPS from Windows settings and not through the browser.

Edit Hosts file to block websites in Windows 11

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