There are many reasons why you may need to edit your hosts file. Maybe you want to block access to a website, play a prank on a friend or make a shortcut to your most regularly visited websites. If you learn how to edit the hosts file in Windows then these tasks can be a doddle.

What Is The Hosts File?

The hosts file dates back to the times before DNS (domain name servers). It was used to create shortcuts to websites that were only identifiable by their IP address.

The hosts file is a plain text file, so it can be opened with programs like Notepad, and is hidden away within the Windows directory on your C:\ drive.

The most common purpose of the hosts file is to map hostnames to IP addresses.

How To Edit The Hosts File In Windows

Edit The Hosts File In Windows 8

The first thing you’ll need to do to edit the hosts file is to open Notepad as Administrator.

The easiest way to do this in Windows 8 is to go to your start screen and type notepad. Typing from the start screen searches your system for programs and files that match what you’ve typed, so typing notepad should show you the Notepad program on the right of the screen. Right click onto it and select Run as Administrator.

From within Notepad click onto File > Open and browse to:


The hosts file can then be edited to make the changes that you need to make.

Edit The Hosts File In Windows 7

In Windows 7 and below you’ll need to click onto the Start menu, type notepad, right click onto the Notepad icon that shows in the search results in the start menu and click Run as Administrator.

From there you can click onto File > Open and browse to the hosts file. You can find the file here:


An alternative for Windows 7 is to click onto Start > Run (or hold the Windows key on your keyboard and tap the letter R) and enter the following:

notepad c:\windows\system32\drivers\etc\hosts

You can then make any changes to the hosts file that you need to make. Just make sure that you save the file once you’re done.

Image Credit: Norlando Pobre