- Find out what the hosts file does, where is the etc folder in Windows, and how you can edit its contents.
- There are tons of old tools buried deep inside Windows.
- The ETC Hosts file is one of these remnants, dating back to 1984.
Operating systems are complex “creatures”, even if on the outside they look friendly. OSes are among the most complex pieces of software out there. It’s a miracle they’re friendly enough to get things done by non-technical people.
Windows is no different, and even if we’re talking about the fresh new version of Windows 11, underneath not every bit is new. For legacy and compatibility reasons Microsoft can’t start from the beginning with Windows, no matter how hard we wish they did.
In this article, we’ll be talking about the etc/hosts file, which dates back to something like 1984, the year, not the book. Funny enough, the etc/hosts file can be used to control people’s behavior, but let’s not spoil things from the beginning.
The etc/hosts file is a text document stored inside the Windows folder. It acts as a local DNS server, where you can manually specify which domain names load from which IPs. The hosts file entries will override DNS settings coming from the Internet servers.

CONTENTS
What’s the Location of the Hosts File? Where Is The etc Folder in Windows?
The hosts file is located in the etc directory in the Windows folder:
C:\Windows\System32\drivers\etc
Now you understand why it’s called etc/hosts, right?

How to View the Contents of the Hosts File?
Now, to view the hosts file contents do the following:
- Copy the path above.
- Open Windows Explorer (Win + E).
- Click on the address bar (or press Alt + D).
- Paste the path (Ctrl + V), then hit enter to open the hosts file location.
Since the hosts file is in text format you can use any text editor. And by any, I mean any program, even Notepad, which we’ll use for demo purposes.
- In the Windows Explorer window, right-click on the hosts file icon.
- Choose Open with.
- From the new popup click on Notepad and hit OK.

The file looks something like this. Below I’ve added the default version that comes with Windows 11. It’s surprisingly legible and has tons of useful info already laid out.

How Can You Edit the Hosts File in Windows?
Now, at this point, if you try and save the file, after modifying it (Ctrl + S), you’ll see the popup below, followed by a small error window that appears after you click Save.

That’s because you didn’t open Notepad with administrator privileges. The etc hosts file is a system file and can’t be modified by everyone. So, close the Notepad window, and let’s try again, but this time we’ll do things a bit differently.
1. Open the Start menu (press the Win key).
2. Type Notepad.
3. Right-click on the first result to open the contextual menu.
4. Click on Run as administrator.

5. Select File > Open (or press Ctrl + O).
6. Navigate to the hosts file location.
7. If the folder appears empty it’s because in the open dialog window system files are hidden by default. Select All files (*.*) in the lower right dropdown menu.

8. Select and open the hosts file.
9. Edit as you please then save with Ctrl + S.
That’s it, you’ve now modified the hosts file.
It would be a good idea to save a backup of the hosts file first, before editing. You can mess up quite a few things by mistake.
How to Add Info to the Hosts file?
The hosts file works like a table with two columns and an infinite number of rows.
You only need two bits of info on each row.
IP | Host name |
192.168.1.200 | binaryfork.com |
The line above will try and load my site from a different IP. It won’t work with this particular IP.
The IP and the host name must be separated by at least a space. You can use more spaces for formatting purposes.
Anything that starts with a # on a row is a comment and will be ignored. You can add a comment after a pair of IP-hostname on the same row to ensure you remember what that line does. You’ll definitely forget.
If you need to find the true IP address associated with a hostname/website or domain name, use this free hostname to IP lookup tool.
What Can You Use the Hosts File For?
I’m not going to lie to you: the first time I heard about the hosts file I only saw the prank possibilities opening up. If you can edit the hosts file on a friend’s computer you can for example point google.com to the IP of bing.com. Some friend, right?
Anyway, that’s not what the hosts file is used for. Developers need to test apps and websites locally, and the hosts file is a great way to point the browser to the domain name of the website you’re working on, but make sure it loads from your computer, not from the Internet.
So, IT professionals are the types of people who use this old Windows functionality.
As with any tool, even the etc/hosts file can be used for malicious purposes. Some malware and viruses are using this file to point your browser to copies of the websites you’re using, just to steal your information. Be careful and if anything looks weird when browsing the web it could be a good idea to double-check the hosts file contents by using the guide above.
Frequently Asked Questions About the Hosts File
This number is known as localhost or loopback address and is the IP that when used will open the browser pointing to the local computer. Imagine you need to call yourself on the phone, to see if the speaker is working. On a normal phone, you can’t do that. With computers, you can.
Web developers are the kind of people who need to use the localhost functionality. Localhost works even on a PC not connected to the Internet.