How to Edit Your Hosts File in Windows 10
The hosts file in Windows 10 dedicated servers is a plain text file used to map hostnames to IP addresses, allowing you to override DNS for specific domains. This is particularly useful for web development, testing, blocking websites, or redirecting domains locally.
Here’s a step-by-step guide on how to safely edit the hosts file on a Windows 10 machine.
What Is the Hosts File?
The hosts file is located at:
C:\Windows\System32\drivers\etc\hostsEach entry in this file maps an IP address to a domain name, e.g.:
127.0.0.1 example.comThis forces the system to resolve example.com to the IP address 127.0.0.1 (localhost) instead of querying DNS servers.
Step-by-Step: Editing the Hosts File
Step 1: Open Notepad as Administrator
You must run a text editor with administrative privileges to edit the hosts file.
Press Start, type
notepad.
Right-click Notepad, choose Run as administrator.
If prompted by UAC (User Account Control), click Yes.
Step 2: Open the Hosts File
In Notepad:
Click File > Open.
Navigate to:
Change file type from “Text Documents (*.txt)” to “All Files“.
Select hosts and click Open.
Step 3: Make Your Changes
Now, you can add or remove lines. Format:
IP_address domain_nameExamples:
Redirect domain to local machine:
Point domain to a specific server:
To block a website:
127.0.0.1 facebook.com⚠️ Each entry must be on a new line, and lines starting with
#are treated as comments.
Step 4: Save and Exit
After editing:
Click File > Save.
Close Notepad.
The changes take effect immediately — no reboot required.
Tip: Test Your Hosts File Changes
Open Command Prompt and type:
ping yourdomain.comIt should show the IP you specified.
You can also test in the browser, or use ipconfig /flushdns to clear DNS cache if changes don’t reflect immediately.
Troubleshooting
Access Denied? Make sure you opened Notepad as an administrator.
Still seeing old IP? Run ipconfig /flushdns in the Command Prompt.
Antivirus conflict? Some security software may block changes to the hosts file — whitelist it if needed.
Use Cases
Preview websites before DNS propagation
Block distracting or malicious sites
Set up development or staging environments
Override DNS without modifying server settings


