The hosts file is located at the following address:

C:\windows\system32\drivers\etc</span>

or

%systemroot%\system32\drivers\etc</span>
But you will need to open Notepad with “Run as Administrator” first and then open it through there otherwise it will give a permissions problem

You’ll typically need to edit the hosts file when pointing a domain to a local dev server or blocking specific addresses. I hit this all the time when testing sites locally before DNS changes go live — just add a line like 127.0.0.1 mysite.local and you’re set. Remember to remove your entries when you’re done, otherwise you’ll spend an hour wondering why the live site isn’t updating. On newer versions of Windows, you might also need to flush the DNS cache with ipconfig /flushdns for changes to take effect immediately.