How to View the Hosts File in Windows 11

Long before complex Domain Name System (DNS) servers existed to translate human-readable website names (like digitash.com) into machine-readable IP addresses (like 192.168.1.1), computers relied on a simple local text file to know where to go on a network. This file is called the “hosts” file. Even in modern operating systems like Windows 11, the local hosts file still exists and takes absolute priority over external DNS servers. System administrators, web developers, and malicious software often modify this file to block certain websites or redirect traffic to local testing servers. If you are troubleshooting strange internet routing issues, viewing your hosts file is a critical first step.

Where is the Hosts File Located?

The hosts file is deeply buried within the Windows operating system architecture to prevent accidental modification by inexperienced users. It has no file extension (it is not a .txt or .doc file); it is simply named “hosts”.

The exact, unchangeable directory path for the hosts file in Windows 11 is:

C:\Windows\System32\drivers\etc\hosts

How to View the Hosts File Using Notepad

Because the hosts file is fundamentally just plain text, you can open it with any basic text editor. The easiest way is to use the built-in Windows Notepad.

  1. Click the Start button or press the Windows key.
  2. Type Notepad.
  3. Click the Notepad application icon to open a blank text document.
  4. In the top menu bar of Notepad, click File and then select Open….
  5. A File Explorer window will pop up.
  6. In the address bar at the very top of the window, carefully paste the exact directory path: C:\Windows\System32\drivers\etc
  7. Press Enter to jump directly to that hidden folder.
  8. Initially, the folder will appear completely empty. This is because Notepad is currently filtering to only look for “.txt” files.
  9. Look at the bottom right corner of the open window, just above the “Open” button. You will see a dropdown menu that says Text Documents (*.txt).
  10. Click that dropdown menu and change it to All Files (*.*).
  11. The hidden files will instantly appear.
  12. Double-click the file named exactly hosts.

Understanding What You Are Looking At

When the file opens in Notepad, you will likely see a block of text. Here is how to interpret it:

  • Comments (#): Any line that begins with a hashtag or pound symbol (#) is a comment. It is completely ignored by the computer. Microsoft uses these lines to explain how the file works. A completely clean, unmodified Windows 11 hosts file usually contains only comment lines.
  • Active Rules: If you see lines that do not start with a #, those are active routing rules. They will always follow a strict format: an IP address followed by at least one space, followed by a website name.
    • Example: 127.0.0.1 www.facebook.com
    • If this rule exists, your computer will physically block you from accessing Facebook, redirecting the traffic back to your own machine (127.0.0.1).

Important Note About Editing

Opening the file via the method above only allows you to view the rules. If you attempt to make changes and save the file, Windows will deny you permission. The hosts file is a protected system file. To edit it, you must open Notepad with strict “Administrator” privileges before opening the file.

Get the best tech tips delivered straight to your inbox.

Join thousands of readers mastering Apple, Google, Microsoft, and Linux.