How to Edit Your Hosts File

The hosts file is a local file on your computer or device that maps domain names to IP addresses. 

So why we should be editing this file? It’s simple, you can use this file to test websites and servers without changing DNS domain records. Let’s say you need to test a website before going live (changing the domain records) and make sure all works great. The Hosts file will help you do that testing.


Where is the Hosts File Located?

Windows 10 – C:\Windows\System32\drivers\etc\hosts

Linux – /etc/hosts

Mac OS X – /private/etc/hosts


Editing the Hosts file in Windows

  1. Click the Windows button and type Notepad in the search bar.
  2. Right click on Notepad and then Run as Administrator.
  3. You’ll be asked, “Do you want to allow this app to make changes to your device?”. click Yes.
  4. In Notepad, choose File then Open.
  5. Navigate to C:\Windows\System32\drivers\etc\ then select on the hosts file.
  6. Add the IP address followed by the domain name at the end of the file. Save the file.
  7. Flush your DNS cache, Click the Windows button and search command prompt. And type: ipconfig /flushdns

And that is it. Next time you type on your browser: it will go to (as an example), instead of the original DNS domain record. So you can test your new website or server.


Once you are done testing, don't forget to remove the hosts entry, save and flush your DNS cache (step 7).

  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

Installing CPanel

After you have purchased a CPanel license from us, you will need to install it on your...

AJAX ERROR messages

After a major Cpanel upgrade, some users see the AJAX error message when trying to check...