In this tutorial, you will learn how to locate and edit your hosts file in Windows 10. The hosts file in Windows 10 is a local file used to map hostnames (like example.com) to IP addresses. Editing this file can help you block websites, test domain redirections, or troubleshoot DNS issues.

Firstly, let’s locate the Hosts File.
The Path is as follows:
C:\Windows\System32\drivers\etc\hosts

Important notes before editing:

  • You must have admin privileges to edit the file.
  • Always create a backup of the original hosts file before making changes.
  • Use a plain text editor like Notepad (not Word or WordPad).

To edit the hosts file in Windows 10, follow the steps:

  1. To open Notepad as Administrator, click Start, search for Notepad, right-click it, and select Run as administrator.
    Run as administrator - Windows10
  2. Open the Hosts File:
    1. In Notepad, go to File > Open.
    2. Navigate to:
      C:\Windows\System32\drivers\etc
    3. Change the file type from Text Documents (.txt) to All Files (.).
    4. Select the file named hosts and click Open.
  3. Add or Modify Entries:
    1. To redirect a domain to an IP address, add a line like:
      0.0.1 example.com

      Each entry should be on a new line. Use the format:

      [IP Address] [Domain Name]
  4. Save the File:
    1. Press Ctrl + S to save your changes.
    2. Close Notepad.
  5. Practical Use Cases:
    1. Block a website
      Add the following entry to prevent access to a specific site:

      0.0.1 facebook.com
    2. Test a domain setup
      Redirect a domain to a staging server by entering:

      168.1.50 staging.example.com
    3. Redirect a domain
      Force a domain to resolve to your local machine:

      0.0.1 example.com
  6. Some important instructions:
    1. Changes take effect immediately, no reboot needed.
    2. You may just need to flush the DNS cache:
    3. Open Command Prompt and run:
      ipconfig /flushdns

In such a manner, you can locate and edit your hosts file in Windows 10. For more such informative articles, do visit our KB section, and for help, contact our support specialists.

Read more knowledge base about How to Edit the Hosts File in Windows, macOS, and Linux

Popular Posts You May Read

Explore more hosting insights, tips and industry updates.

Private LAN – VLAN Dedicated Servers

Private LAN Configuration on a Dedicated Server. BODHost Offers Private LAN or VLAN Dedicated Server…

Remove Domain Name or Website from Control Panel

Managing domains is a routine task in any control panel. Whether you want to remove…

Reasons Why You Should Use a Content Delivery Network (CDN)

If you run a website or online business, you will want to ensure that your…