How to Edit the Hosts File in Windows

Published On: September 8th, 2015|Last Updated: January 7th, 2023|Categories: Windows|Total Views: 1259|Daily Views: 1|

Are you want to redirect or block a website from your computer browser by using hosts file? You cannot easily edit the hosts file since it is protected in windows operating systems. If you try to edit and save the hosts file, you will get error as “You don’t have permission to save in this location” or a “Save as dialog box” appears to save as a different file. Follow the below steps to edit the hosts file in windows.

Instructions

  1. Deactivate the antivirus, because some antivirus application might prevent the editing of hosts file from virus or automated software. In windows 10, if you are not using any third party anti virus, then add the hosts file into windows defender exclusion list.
  2. In windows 8/8.1/10, search for an application “Notepad”. In Windows XP/7, click Start and then click All Programs -> Accessories and choose Notepad.
  3. Right click on the Notepad application and click Run as Administrator. If it is prompted for and admin password, enter the admin password and click OK or Continue.
  4. In Notepad, click File and then select Open…
  5. Browse to the location C:\Windows\System32\drivers\etc and select the hosts file and click Open.
  6. Now the hosts file is ready for editing. Bring the cursor at the end of the file and click ENTER.
  7. Add any website address which you want to block in your system. For example, I edit the hosts file to block the website youtube.com.
  8. Click File and then select Save to save the changes.

Tips and Warnings:

  1. Don’t make any changes in the default value of the hosts file.
  2. Once you blocked the website in hosts file, you cannot have access to that website in any of the browser.
  3. You should have system administrator access to edit the hosts file.
  4. Once you finish editing the hosts file, activate the antivirus software to prevent your system.

Leave A Comment