How to Fix Fix Windows Hosts File Corrupted, Missing, or Blocked on Windows
Hosts file corrupted or missing? Websites not loading after hosts file edit? Cannot save changes to hosts file? Fix Windows hosts file issues on Windows 10 and 11.
📖
Main Troubleshooting Guide
How to Fix No Internet Connection →Complete symptoms, causes, and step-by-step solutions
Symptoms
You might be experiencing this problem if you notice:
- •Websites not loading or redirecting incorrectly after hosts file changes
- •Cannot save changes to hosts file — "Access denied" error
- •Hosts file is empty or missing from System32\drivers\etc
- •DNS resolution bypassing hosts file entries
- •Antivirus blocking changes to the hosts file
- •Hosts file changes not taking effect even after DNS flush
Common Causes
- ⚠Hosts file does not have correct permissions for editing
- ⚠Antivirus or security software protecting hosts file from modification
- ⚠Hosts file saved with wrong encoding (must be ANSI or UTF-8 without BOM)
- ⚠Hosts file has incorrect format or syntax errors
- ⚠DNS Client service caching old entries over hosts file
- ⚠Hosts file was deleted or replaced by malware cleanup tool
Solutions
Solution 1: Edit Hosts File Correctly
- 1Open Notepad as Administrator (right-click → Run as administrator)
- 2File → Open → navigate to C:\Windows\System32\drivers\etc
- 3Change file filter from "Text Documents" to "All Files"
- 4Open the file named "hosts" (no extension)
- 5Add entries in this format: 127.0.0.1 example.com
- 6Use a tab or spaces between the IP and hostname
- 7Save the file (Ctrl+S)
- 8Flush DNS cache: open Command Prompt → ipconfig /flushdns
Solution 2: Fix Permissions and Access Issues
- 1If you cannot save the hosts file:
- 2Navigate to C:\Windows\System32\drivers\etc in File Explorer
- 3Right-click "hosts" → Properties → Security tab
- 4Click Edit → select your user account → check "Full control"
- 5Click Apply → OK
- 6If antivirus is blocking: temporarily disable real-time protection
- 7Make your changes, save, then re-enable antivirus
- 8Some antivirus (like Avast, Norton) specifically protect the hosts file — add an exclusion
Solution 3: Restore Default Hosts File
- 1If the hosts file is corrupted or missing, recreate it:
- 2Open Notepad as Administrator
- 3Paste the default content:
- 4# Copyright (c) 1993-2009 Microsoft Corp.
- 5# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
- 6# 127.0.0.1 localhost
- 7# ::1 localhost
- 8Save as: C:\Windows\System32\drivers\etc\hosts
- 9Important: save as "All Files" type, not .txt
- 10Ensure encoding is ANSI or UTF-8 (without BOM)
FIXES THIS IN 5 MINUTES
Fix Fix Windows Hosts File Corrupted, Missing, or Blocked Automatically
RescuePC Toolkit includes 109+ automated repairs that fix this problem with one click. No command line knowledge required.
Download Now - Free TrialNo credit card required • Works on Windows 10 & 11