LOGO

Edit Hosts File Windows: Free Tool for Editing, Deleting & Restoring

November 28, 2012
Edit Hosts File Windows: Free Tool for Editing, Deleting & Restoring

Understanding and Utilizing the Windows Hosts File

The hosts file within Windows functions as a mapping system, associating IP addresses with corresponding host names – essentially, a personalized address directory for your computer. When your PC attempts to locate websites, it relies on IP addresses; therefore, it must translate host names into these numerical addresses to establish a connection.

How the Hosts File Impacts Website Access

Upon entering a host name into your web browser, your system initially consults DNS servers to determine the associated IP address. However, if you've pre-defined IP address and host name pairings within the hosts file, website loading times can be improved. This is because the hosts file is loaded into memory during Windows startup, effectively bypassing DNS queries and providing a direct route to the desired site.

Blocking Websites and Enhancing Privacy

The hosts file’s priority lookup also allows for website blocking, preventing tracking of your online activities. It can be used to disable advertisements, banners, third-party cookies, and other potentially intrusive webpage elements. Your computer possesses a dedicated address, known as "localhost," with the IP address 127.0.0.1. To block specific sites or elements, you can direct the host name of the unwanted resource to this localhost address.

Adding Entries to the Hosts File

The standard hosts file included with Windows is initially empty of any host name/IP address mappings. You can manually add these mappings, for instance, associating the IP address 74.125.224.72 with www.google.com. To block an advertising server, such as doubleclick.net, you could add the following line to your hosts file:

127.0.0.1    ad.doubleclick.net

NOTE: It’s important to understand that the hosts file allows blocking of entire domains, not individual components within a site. Blocking ads served *by* a website requires blocking the entire domain.

Manually Editing the Hosts File

To add entries manually, locate and open the hosts file (C:\Windows\System32\drivers\etc\hosts) using a text editor like Notepad.

NOTE: The hosts file does not have a file extension.

Utilizing Host Mechanic for Simplified Management

A more user-friendly approach to managing the hosts file is through a free tool called Host Mechanic. This utility simplifies adding entries, restoring the default hosts file, and even deleting the file altogether.

Host Mechanic is a portable application, meaning it doesn’t require installation. Simply extract the downloaded .zip file (available at the link provided at the end of this article) and double-click the Host Mechanic.exe file.

use-a-free-tool-to-edit-delete-or-restore-the-default-hosts-file-in-windows-1.jpg

If prompted by User Account Control, click Yes to proceed.

NOTE: The User Account Control dialog may not appear, depending on your system’s security settings.

use-a-free-tool-to-edit-delete-or-restore-the-default-hosts-file-in-windows-2.jpg

Adding and Managing Entries with Host Mechanic

To add a new entry, input the desired host name in the "Site" field. To block a site, check the "127.0.0.1" checkbox. Alternatively, enter the site’s IP address in the "IP Address" field. Click "Add to Host" to save the entry.

use-a-free-tool-to-edit-delete-or-restore-the-default-hosts-file-in-windows-3.jpg

A confirmation message will appear; click "OK" to dismiss it.

use-a-free-tool-to-edit-delete-or-restore-the-default-hosts-file-in-windows-4.jpg

Scrolling down within the "Host File Content" box will reveal the newly added entry at the bottom of the file.

use-a-free-tool-to-edit-delete-or-restore-the-default-hosts-file-in-windows-5.jpg

Restoring and Deleting the Hosts File

To revert to the original Windows hosts file, click "Restore Default Host File."

use-a-free-tool-to-edit-delete-or-restore-the-default-hosts-file-in-windows-6.jpg

Another confirmation dialog will be displayed.

use-a-free-tool-to-edit-delete-or-restore-the-default-hosts-file-in-windows-7.jpg

NOTE: This action will remove all your modifications, leaving the hosts file containing only the default commented instructions.

use-a-free-tool-to-edit-delete-or-restore-the-default-hosts-file-in-windows-8.jpg

In cases where the hosts file has been compromised by malware, you can delete it using the "Delete Host File" option in Host Mechanic and then create a new one in the C:\Windows\System32\drivers\etc directory. Refer to Microsoft’s documentation for the default content of the hosts file for different Windows versions (XP, Vista, 7, Server 2003, and Server 2008).

use-a-free-tool-to-edit-delete-or-restore-the-default-hosts-file-in-windows-9.jpg

Upon deleting the hosts file, a confirmation dialog will appear.

use-a-free-tool-to-edit-delete-or-restore-the-default-hosts-file-in-windows-10.jpg

To exit Host Mechanic, click the "X" in the upper-right corner of the window.

use-a-free-tool-to-edit-delete-or-restore-the-default-hosts-file-in-windows-11.jpg

Download Host Mechanic from http://browse.deviantart.com/?q=host+mechanic#/d4g95l7.

NOTE: You may encounter a malware warning when using Host Mechanic. The AskVG website, the source of this software, indicates this is a false positive, as the tool modifies a system file which can trigger security software. However, it is generally considered safe to use.

Further Resources

For additional information on editing and utilizing the hosts file, consult these resources:

  • Beginner Geek: How To Edit Your Hosts File
  • Stupid Geek Tricks: Create a Shortcut to Quickly Edit Your Hosts File
  • How to Block Websites in Windows 8′s Hosts File

Pre-configured hosts files, containing entries to block common trackers, hijackers, ad servers, and unwanted software, are also available for download.

#hosts file#windows#edit hosts file#delete hosts file#restore hosts file#free tool