logo
Windows 10 2 Ways to Open Hosts File in Windows 10

2 Ways to Open Hosts File in Windows 10

By Jennifer | Last Updated

The hosts file serves as your computer's local address book for websites - a simple text document that directly links domain names to numerical IP addresses (like pointing 'localhost' to 127.0.0.1). This powerful yet often overlooked tool enables you to: Redirect web traffic before it reaches the internet; Safely test website changes on your own machine; Block malicious or distracting domains at the system level. Hidden in your system's secure directories, modifying this file demands administrator privileges, acting as a built-in gatekeeper against accidental changes. Here you can learn two methods to access it.

Way 1: Unfold it by Run.

Step 1: Launch Run by Windows+R, type c:\windows\system32\drivers\etc\hosts in the box and click OK.

open host file by run

Step 2: Choose a way to open the file and tap OK.

tap OK

When prompted by User Account Control, click Yes to open Notepad with administrator privileges. You're now editing the hosts file directly. Make your changes, then File > Save when finished.

Way 2: Open hosts file in This PC.

Step 1: Open File Explorer, In the address bar, paste: C:\Windows\System32\drivers\etc to find the host file, and double-click hosts.

find host files

Step 2: Select a way to open it and hit OK.

select a way to open

FAQs about Host Files

Q1: What is the hosts file used for?

It overrides DNS lookups by specifying custom mappings of domain names to IP addresses on your local PC.

Q2: Is it possible to edit the hosts file without admin rights?

No—Windows protects the file. You must open Notepad or another editor as an administrator to save changes.

Q3: How do I restore the default hosts file?

Rename your modified hosts file (e.g., hosts.old), then restore the default file from %WinDir%\System32\drivers\etc\hosts, or refer to Microsoft’s instructions to reset it.

Q4: Why aren’t my hosts file changes working?

After saving your edits, run ipconfig /flushdns in an elevated Command Prompt to clear the DNS cache.

Conclusions

By using either the Run dialog or File Explorer methods, you can reliably open, edit, and manage the hosts file in Windows 10—giving you full control over local domain mapping and testing.

Related Articles: