🔒 How to Block and Unblock Websites in Computer Using Hosts File
Sometimes you need to block certain websites for productivity, parental control, or security. Using the Windows hosts file, you can easily block or unblock any website without installing extra software.
🌐 What Hosts File Does?
- Redirects websites to your local computer
- Blocks unwanted websites
- No extra software required
- Works on all browsers in your computer
🧩 PART 1: Open Hosts File in Windows
- Press Windows + R
- Type notepad and press Enter
- Click File → Open
- Navigate to C:\Windows\System32\drivers\etc
- Select All Files instead of Text Documents
- Open hosts file
💻 PART 2: Block a Website
Add the following lines at the end of the hosts file:
127.0.0.1 www.facebook.com
127.0.0.1 facebook.com
127.0.0.1 facebook.com
💡 Tip: Replace facebook.com with any website you want to block.
🧩 PART 3: Save Hosts File & Clear DNS
- Click File → Save (Admin permission required)
- Open Command Prompt as Administrator
- Type ipconfig /flushdns and press Enter
✔ Success: The website is now blocked on your computer.
🔹 PART 4: Unblock a Website
To unblock, simply open the hosts file again and delete or comment the line with the website:
#127.0.0.1 www.facebook.com
#127.0.0.1 facebook.com
#127.0.0.1 facebook.com
Save the file and run ipconfig /flushdns again to refresh.
⚠ Note: Do not delete system entries from hosts file. Always backup before editing.
🛡 PART 5: Advantages of Using Hosts File
- ✅ No third-party software required
- ✅ Permanent until manually removed
- ✅ Works for all browsers
- ✅ Easy and free method
📌 Conclusion
- Using Windows hosts file to block/unblock websites is simple, fast, and effective.
- Perfect for office, parental control, and personal productivity.
- Always backup hosts file before making changes.
अब आप आसानी से किसी भी website को block या unblock कर सकते हैं अपने Windows computer में।
