Hosts File

A hosts file is a local text-based file used to map domain names to specific IP addresses, allowing users to customize how certain domains are accessed. It is mainly used for DNS override and can be helpful when developing or testing websites before they go live.


What is a Hosts File?

Host files are an essential part of the Domain Name System (DNS), and they can be used for a variety of purposes such as blocking malware-infected sites, redirecting URLs, and more. Hosts files are generally easy to edit, making them an ideal choice for beginners who want to customize their web browsing experience.

Common Applications for Hosts Files

Web Development

Hosts files are an important tool in web development, as they can be used to test new websites before they go live. They can also be used to test changes to existing websites without disrupting the live version of the site. Hosts files can also be used to redirect URLs, allowing developers to quickly switch between different versions of a website while testing. This makes it easier for developers to rapidly iterate on their websites, without having to wait for DNS propagation times or manually edit their domain’s DNS records.


Hosts files can also be used to improve security. By blocking malicious domains in the hosts file, users can prevent their computer from connecting to potentially dangerous websites. Additionally, hosts files can be used to hide IP addresses or domain names of sensitive sites, making it harder for malicious actors to target those sites. Hosts files can be an effective additional layer of protection against malware and other threats by blocking known bad URLs.

Locating Your Hosts File


To locate a hosts file on a local Windows computer, first open the File Explorer by pressing the Windows key + E. Next, navigate to ‘C:\Windows\System32\drivers\etc’. In this folder, you will find the ‘hosts’ file. Open it with Notepad or other text editor and make any changes that you need to make. It is important to note that these changes may require administrator privileges in order to be saved.


Open Finder, then select Go > Go to Folder… from the Mac menu bar. Once you open the file with TextEdit or other text editor, you can make any changes that you need to make. Just like on Windows, administrator privileges are often required for these changes to be saved.

How to Edit the Hosts File

Making changes to your hosts file, all you need is basic knowledge of working with text files and the ability to access your computer’s administrator privileges.

Once you have opened the hosts file, make the necessary changes and save it with administrator privileges. It’s important to note that modifications may not take effect immediately, so you should restart your computer after making any adjustments.

Finally, be mindful of any potential security risks when editing your hosts file as it can open the door for malicious activity or unauthorized access if done incorrectly. For example,  malicious software may be able to change your hosts file, redirecting requests for certain websites to a different server.

To prevent this from happening, make sure you install and run anti-malware software regularly.

Special Offer
Shared Website Hosting
Our Shared Hosting plans offer a user-friendly interface and flexible options to fit your needs, with a 97-Day Money-Back Guarantee.