How to modify your hosts file.

What is your hosts file and why would you want to modify it?

First we need a quick explanation on how the Domain Name System (DNS) works. When you type a domain name into your browsers address bar, your computer does a look up on the nameservers for that domain in order to find out the IP address it should connect to in order to download the web page. Your hosts file can override that request for your workstation only. This is great for developing a new site or testing out a site on a new account without actually affecting the current “live” site.

At EZP we tell our clients to modify their hosts file all the time and so we decided to publish a walk through for the most common operating systems we see.

All you need for this is the domain name and the IP address. For the walk through we will use and as an example, please do not use this information. If you need help, simply ask our support team.

First up, how to edit your hosts file on a Mac OS X 10.6+.

Click your Finder icon (Magnifying Glass) or open Applications, Utilities, and open Terminal.

Once you have terminal open, type in:

sudo nano /private/etc/hosts

Enter your administrator password and press enter.

Go to the bottom of the file, enter IP address of the server, press tab and enter the domain name.

It should look similar to the following:

Hit your control and O button to save, then X to exit.

Once you have closed the Nano Text Editor, you will need to run the following command in the terminal to flush your cache:

dscacheutil -flushcache

Once complete, you can close Terminal, and open a browser to access your site on the new IP while everyone else in the world still goes to the old one!

Next up, Windows 8-10.

For these 2 Operating Systems, you will want to press the Windows key, and search for Notepad.

In the Search results, right-click on Notepad, and click Run As Administrator.

You will want to open your hosts file from the following lcoation:


The hosts file format is identical to the mac example above:

Finally, click File, and save your changes.

Now you can fire up a browser and see the site on the IP you set in the hosts file.

Let’s walk you through Windows Vista & 7.

Go to your Start Menu, All Programs, Accessories.

Right click on Notepad, and run as Administrator.

Click Continue, giving Windows permission to open Notepad with Administrator privileges.

In Notepad, go to File, Open.

In the File name field, you will want to enter the following:


Yes, the hosts file format is still the same:

Once you have made the necessary changes, go to File, Save.

And if you fire up a browser, you should be able to see the site on the IP specified in your hosts file.

Finally, how to modify your hosts File in Windows 2000/XP/NT.

You will need to open your Start Menu, go to All Programs, Accessories, and finally Notepad.

Once you have opened NotePad, go to File, Open, and in the File name field, enter the following based on which Operating System you are using:

Windows 2000 = C:windows\system32\drivers\etc
Windows XP = C:\windows\system32\drivers\etc
Windows NT = C:\winnt\system32\drivers\etc

You will want to make entries in the following format:

Once you have made the necessary changes, go to File, Save.

You are done! Fire up your browser and test it out, you should now be going to the new IP.


When you are finished testing the site out, you should follow the instructions to access your hosts file again and remove the entries you have added!