A ‘hosts’ file is a plain text file, which maps hostnames to IP addresses. A host file helps in addressing network nodes in a computer network. A hostname is a human-friendly name or label assigned to a device (a host) on a network and is used to distinguish one device from another on a specific network or over the internet.

If you have been a tech-savvy person, you would be able to access and modify the Windows hosts file to solve certain issues or block any websites on your device. The hosts file is located at C:\Windows\system32\drivers\etc\hosts on your computer. Since it is a plain text file, it can be opened and edited in notepad. But Sometimes you may encounter ‘Access Denied’ error while opening hosts file. How will you edit the host file? This error will not let you open or edit the hosts file on your computer. In this article, we will discuss various methods to solve Can’t edit the hosts file on Windows 10 issue. Editing a hosts file is possible and you might need to do it for a variety of reasons.

You can create website shortcuts by adding a required entry in the hosts file that maps the website IP address to a hostname of your own choice. You can block any website or ads by mapping their hostname to the IP address of your own computer which is 127.0.0.1, also called loopback IP address.

Fix Access denied when editing hosts file in Windows 10

Make sure to create a restore point just in case something goes wrong.

Fix Access denied when editing hosts file in Windows 10 Why can’t I edit the hosts file, even as Administrator? Method 1 – Open Notepad with Administrator Access Method 2 – Disable Read-only for the hosts file Method 3 – Change the Security settings for the hosts file Method 4 – Change the hosts file location

Why can’t I edit the hosts file, even as Administrator?

Even if you try to open the file as an Administrator or use the built-in Administrator account to modify or edit the hosts file, you are still unable to make any changes to the file itself. The reason being that the access or permission required to make any changes to the hosts file are controlled by TrustedInstaller or SYSTEM.

Method 1 – Open Notepad with Administrator Access

Most of the people use notepad as a text editor on Windows 10. Therefore, before you edit the host file, you need to run Notepad as Administrator on your device.

  1. Press Windows Key + S to bring up the Windows Search box.

  2. Type notepad and in the search results, you will see a shortcut for Notepad.

  3. Right-click on Notepad and select ‘Run as administrator’ from the context menu.

  4. A prompt will appear. Select Yes to continue.

  5. Notepad window will appear. Select File option from the Menu and then click on ‘Open‘.

  6. To open the hosts file, browse to C:\Windows\system32\drivers\etc.

  7. If you can’t see the hosts file in this folder, select ‘All Files’ in the option below.

  8. Select the hosts file and then click on Open.

  9. You can now see the contents of the hosts file.

  10. Modify or make the required changes in the hosts file.

11. From Notepad menu go to File > Save or press Ctrl+S to save the changes. It is important to note that this method works with all text editor programs. Therefore, if you use another text editor program apart from notepad, you just need to open your program with Administrator access. Alternative Method: Alternatively, you can open the notepad with admin access and edit the files using the Command Prompt. 1.Open the command prompt with admin access. Type CMD in Windows search bar then right-click on Command Prompt and choose Run as administrator.

2.Once the elevated command prompt opens, you need to execute the below-given command 3.The command will open the editable host file. Now you can make the changes to the hosts file on Windows 10.

Method 2 – Disable Read-only for the hosts file

By default, the hosts file is set to open but you cannot make any changes i.e. it is set to read-only. In order to fix Access denied when editing hosts file error in Windows 10, you need to disable the read-only feature. 1.Navigate to C:\Windows\System32\drivers\etc.

2.Here you need to locate the hosts file, right-click on it and choose Properties.

3.In the attribute section, uncheck the Read-only box.

4.Click Apply followed by OK to save the settings Now you can try to open and edit the hosts file. Probably, the problem of access denied will be solved.

Method 3 – Change the Security settings for the hosts file

Sometimes getting access to these files requires special privileges. It could be one reason that you may not be given full access, therefore, you are getting access denied error while opening hosts file. 1.Navigate to C:\Windows\System32\drivers\etc. 2.Here you need to locate the hosts file, right-click on the file and choose Properties. 3.Click on the Security tab and click on the Edit button.

4.Here you will find a list of users and groups. You need to ensure that your user name has full access and control. If your name is not added in the list, you can click on the Add button.

5.Select the user account via the Advanced button or just type your user account in the area which says ‘Enter the object name to select’ and click OK. 

6.If in the previous step you have clicked on the Advanced button then click on “Find now” button.

7.Finally, click OK and checkmark “Full Control”.

8.Click Apply followed by OK to save changes. Hopefully, now you will be able to access and edit the hosts file without any issues.

Method 4 – Change the hosts file location

Some users noted that changing the file location has solved their problem. You can change the location and edit the file thereafter put the file back to its original location. 1.Navigate to C:\Windows\System32\drivers\etc. 2.Locate the Hosts file and copy it.

3.Paste the copied file on your Desktop where you can easily access that file.

4.Open the hosts file on your Desktop with Notepad or another text editor with Admin access.

5.Make the necessary changes on that file and save changes. 6.Finally, copy & paste the hosts file back to its original location: C:\Windows\System32\drivers\etc. Recommended:

Create Multiple Gmail Accounts Without Phone Number Verification Identify and Install Missing Audio & Video Codecs in Windows Fix The Diagnostics Policy Service Is Not Running Error 10 Ways To Fix Slow Page Loading In Google Chrome

That’s if you have successfully Fix Access denied when editing hosts file in Windows 10 but if you still have any queries regarding this article then please feel free to ask them in the comment’s section.

Fix Access denied when editing hosts file in Windows 10 - 20Fix Access denied when editing hosts file in Windows 10 - 51Fix Access denied when editing hosts file in Windows 10 - 59Fix Access denied when editing hosts file in Windows 10 - 23Fix Access denied when editing hosts file in Windows 10 - 66Fix Access denied when editing hosts file in Windows 10 - 32Fix Access denied when editing hosts file in Windows 10 - 3Fix Access denied when editing hosts file in Windows 10 - 78Fix Access denied when editing hosts file in Windows 10 - 95Fix Access denied when editing hosts file in Windows 10 - 62Fix Access denied when editing hosts file in Windows 10 - 17Fix Access denied when editing hosts file in Windows 10 - 36Fix Access denied when editing hosts file in Windows 10 - 24Fix Access denied when editing hosts file in Windows 10 - 90Fix Access denied when editing hosts file in Windows 10 - 3Fix Access denied when editing hosts file in Windows 10 - 25Fix Access denied when editing hosts file in Windows 10 - 4Fix Access denied when editing hosts file in Windows 10 - 61Fix Access denied when editing hosts file in Windows 10 - 68Fix Access denied when editing hosts file in Windows 10 - 71Fix Access denied when editing hosts file in Windows 10 - 51Fix Access denied when editing hosts file in Windows 10 - 7