The hosts file is a file located on your computer that is used as a first point of lookup for DNS hostname resolution.
A common use for making changes to this file is to test DNS changes before making them live on the Internet as well as setting up custom hostnames for local testing.
Provided below is instructions on editing this file on various operating systems.
The hosts file for Windows is located in
In order to edit this file, you will need to do so as the local system administrator. This can be done by right clicking on the shortcut to your favorite text editor (which can be as simple as Notepad) and choosing the
Run as administrator option.
Once you have this file open, the format is very simple. On a new blank line you need to enter the desired IP address followed by a space (or tab) and then the hostname you would like to assign to this. You can add additional hostnames departed by spaces (or tabs) as well.
or multiple hostsnames at once:
127.0.0.1 example.com www.example.com mysite.com
The hosts file for Mac OS X is located in
/etc/hosts for quick access although as this file is a symbolic link with the actual file is located in
/private/etc/hosts. Editing either file is fine.
The hosts file for Unix, Linux and other Unix like operating systems is located in