How to Find and Edit the Hosts File in Windows 11

There are numerous ways tofind 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)

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 as0.0.0.0), the website won’t open and will effectively be blocked. In essence, thehosts file keeps a list of all the websites that you have blocked on your PC.

Having said that, if you are using one of thepopular DNS serversin your browser, the browser willignore 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 suggestenabling DNS over HTTPS (DoH) on Windows 11from 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 bypointing 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 theWindows 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 tosystem32 -> drivers -> etcfolder. 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, makea copy of the “hosts” fileto 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 bottomby following the below syntax. Here, you are pointingtwitter.comto0.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.

  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 opentwitter.com, and itwon’t openon 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, simplyremove the lineyou 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)

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 atC:\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 tofind the Windows 11 Startup folderin Windows 11, use our linked guide. And tofind 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.

Arjun Sha

Passionate about Windows, ChromeOS, Android, security and privacy issues. Have a penchant to solve everyday computing problems.

Add new comment

Name

Email ID

Δ

01

02

03

04

05