HomeWindows 10How to Modify or Edit Hosts File in Windows...

How to Modify or Edit Hosts File in Windows 11/10/8/7?

In this post, we will guide you on modifying or editing the Hosts file of Windows 11/10/8/7. Before proceeding with the steps, let me clear a few points related to the Hosts file in the Windows operating system.

What is a Hosts File?

The Hosts file is a plain text file that maps servers or hostnames to IP addresses. It is the method to resolve hostnames to a specific IP address. The Hosts file is usually the first process in the domain name resolution procedure. It is located in the Windows folder: C:\Windows\System32\Drivers\etc. Here is an example of the Hosts file entry:- gearupwindows.com #gearupwindows

The first section is the IP address which a request will be redirected to. The second section designates the location where we want to redirect a request from. The third section specifies a comment for the entry, starting with #. Each entry is usually separated by a space or a tab.

Why is a Hosts File Useful?

Imagine you have just completed a migration to a new server. To see how your domain will look and operate on a new server before moving to DNS settings, modify the Hosts file and add a new entry to your new server.

You can simply modify the Hosts file to point the domain to the new server’s IP. If our domain is gearupwindows.com, the old IP is, and the new IP is, you can temporarily comment out the current gearupwindows.com entry (using a ‘#’ symbol) and add an alternate entry that points to the new server IP.

# gearupwindows.com #old gearupwindows.com #new

If we add the above entry to our Hosts file, every time we open gearupwindows.com in our browser, we will be redirected to the IP.

How to Modify or Edit Hosts File in Windows 11/10/8/7?

The Hosts file can be edited with any text editor. But when you try to save this file, you will get an error, “Access is denied.” By default, the Hosts file is protected from user changes. Before editing, you need to take ownership of the Hosts file to have full permission for it. To get full access to the Hosts file, perform the following steps:-

Step 1. Download and install the freeware tool TakeOwnershipPro on your computer.

Step 2. Once TakeOwnerShipPro is installed on your PC, open the following folder:-


Step 3. Right-click on the hosts file and select TakeOwnershipPro from the right-click context menu.

Step 4. When the TakeOwnershipPro dialog opens with progress done, you can close it.

Step 5. Now open the Hosts file with any text edit, e.g., Notepad or Wordpad. Make the changes according to your choice and save them.

How to block a particular website using the Hosts file?

The Hosts file is handy and can block access to any websites you don’t want to visit. For example, suppose we don’t want to browse youtube.com anymore on our computer. We add the following line to the end of the Hosts file: youtube.com

Now save the Hosts file and restart your computer to apply the changes. Now any user of your computer can not browse youtube on your PC.

Note: Now you have understood the power of the Hosts file of the Windows operating system. The Hosts file can also be used by viruses, malware, or hackers to redirect you to phishing and other dangerous sites. To prevent hijacking or unauthorized changes to the Hosts file, it is always recommended to make it read-only. Browse the Hosts file folder: C:\Windows\System32\drivers\etc. Right-click the Hosts file, select Properties, check the Read attribute, and click OK.


In conclusion, the Hosts file is a plain text file that maps hostnames to IP addresses, and it is a useful tool to redirect domain names before updating DNS settings. However, before modifying the Hosts file in Windows 11/10/8/7, it is necessary to take ownership of the file and make it read-only to prevent unauthorized changes. Additionally, the Hosts file can also be used by viruses, malware, or hackers to redirect users to dangerous sites. Therefore, it is essential to use caution when editing the Hosts file and to ensure that it is properly secured to prevent security breaches.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Exclusive Giveaway: Get FRANZIS DENOISE Projects 2 Pro for Free – Your Path to Noise-Free Photography!

In the realm of digital photography, there's always one nemesis that photographers, whether amateurs or professionals, grapple with: noise. Image noise, those pesky specks...

Unlock a Year of Secure Password Management: Sticky Password Premium 1-Year Free Giveaway!

Are you tired of struggling to remember all your passwords? Do you find yourself spending precious time entering login credentials over and over again?...

Unlock Seamless iPhone 15 Data Management with FoneTool Professional: Participate & Win!

With the evolution of technology, managing data on our devices has become a task that requires both precision and ease. The release of the...

Unlock the Power of PPTube Video Downloader for Windows: Free 3-Month License Giveaway

If you're a video enthusiast who loves to download and watch high-definition content from various streaming websites, then you're in for a treat! PPTube...

Experience Seamless Video Downloading with PPTube Video Downloader for Mac: Features and Free License Key Giveaway

The rise of digital content has made videos an integral part of our daily lives. We consume video content for entertainment, education, and information...

Related Posts