How to modify the hosts file on Windows and Mac?

The hosts file is a crucial component of a computer system’s networking setup that acts as a map to locate hosts on IP networks. It is a local file that contains domain names and matching IP addresses. 

You might be required to modify the host file in numerous scenarios, such as while testing websites, blocking access to certain websites, or setting up a local domain. It allows you to override the default DNS lookup process and manually specify the IP address for a domain name.

Modifying the Host File on Windows 

Before you modify the Hosts file on Windows, you will require an IP address. To find the same follow the below-mentioned steps:

Step 1: Log in to the hPanel

Step 2: On the left sidebar, navigate to Hosting > Plan Details > Website IP address

Step 3: Copy the IP address reflecting on the screen


After you have the IP addresses, there are two approaches you can take o edit host files on Windows. 


  • Manual File Change

You can change the host file manually by navigating the steps mentioned below:

Step 1: Click the Windows icon and type Notepad in the search bar.

Step 2: Right-click on the Notepad and Run it as an administrator

Step 3: Navigate to File and click on Open

Step 4: Go to C:\Windows\System32\Drivers\etc 

Step 5: Select All Files and locate the hosts file

Step 6: Edit the hosts’ file. Add the IP address, followed by space, and then the domain name

Step 7: Save your changes


  • Use Hosts File Editor Tool 

You can use the hosts’ file editor tool to modify the hosts’ files in Windows 10 or 11 easily. After you have downloaded the file, follow the below-mentioned steps:

Step 1: Launch the Hosts File Editor Tool

Step 2: Fill in the IP address and domain name under the required columns

Step 3: Save the changes

Modifying the Host File on Mac

To modify the host files on Mac, follow the steps shared follow:

Step 1: Click on Launchpad and open Terminal

Step 2: Modify the Hosts file in the Terminal Windows by using any of the below-mentioned commands

sudo nano /private/etc/hosts


sudo nano /etc/hosts (for latest Mac Versions)

Step 3: Enter your Apple login credentials

Step 4: Edit the hosts file by adding the IP address followed by space and domain name

Step 5: Press Control+O to save the changes

Bottom Line

The hosts file is a powerful tool that can help you redirect or block specific sites. Follow the steps shared above to modify your hosts files. Be cautious while making changes, as mistakes can lead to network issues on your system. 

Have questions?

Ask us.

    AWS Standard Consulting Partner

    • Go4hosting
    • Go4hosting

    Alibaba Cloud


    Go4hosting-NOW-NASSCOM-Member Drupal Reseller Hosting Partner

    Cyfuture Ltd.

    The Cricket Barn
    EX16 8ND

    Ph:   1-888-795-2770
    E-mail:   [email protected]