Here's how to edit the Windows HOSTS file, which is necessary to create custom domain redirects, block websites, or remove malicious entries set by malware. Instructions apply to Windows 10, 8, 7, and XP.
How to Edit the Hosts File in Windows 10
In Windows 10, 8, and 7, you cannot save edits to the HOSTS file unless you open it directly from Notepad or another text editor. To do this:
Open Notepad or another text editor, such as Notepad++.
In the text editor, select File > Open and open the location of the HOST file at C:/Windows/System32/drivers/etc/.