How to edit the local host file in Windows 10

|

|

This tutorial guides students and new users on how to modify Windows 10 local host files. Host files, plain-text files used by the operating system to map IP addresses to hostnames, override DNS. Modifications in the host file situated at c:\Windows\System32\Drivers\etc\hosts, can be made using Notepad or any text editor. The changes take effect immediately.…

This brief tutorial shows students and new users how to edit or modify Windows 10 local host files.

The Local Host File in Windows 10 maps IP addresses to hostnames on the local computer. It has priority over DNS. When you type in a domain name in your browser to go to a website, your computer translates the domain name into an IP address and connects to the server hosting the website.

If the IP to domain mapping isn’t included in the host file, it looks up a DNS server online. So, editing the local host file in Windows 10 can be useful if you want to access a website using a specific IP address or if you want to block access to certain websites by redirecting their IP address to a different address.

Overall, editing the local host file can be a useful tool for network administrators or users who want more control over their computer’s network settings.

Open Windows 10 Hosts File

The process of editing Windows 10 host files is simple. To add an entry or modify the host’s File, simply open the host’s File at the path below using Notepad or any other text editor.

c:\Windows\System32\Drivers\etc\hosts

A similar line below should appear in the File.

# Copyright (c) 1993-2009 Microsoft Corp.
#
# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
#
# This file contains the mappings of IP addresses to host names. Each
# entry should be kept on an individual line. The IP address should
# be placed in the first column followed by the corresponding host name.
# The IP address and the host name should be separated by at least one
# space.
#
# Additionally, comments (such as these) may be inserted on individual
# lines or following the machine name denoted by a '#' symbol.
#
# For example:
#
#      102.54.94.97     rhino.acme.com          # source server
#       38.25.63.10     x.acme.com              # x client host

# localhost name resolution is handled within DNS itself.
#	127.0.0.1       localhost
#	::1             localhost

Changes you make to the host’s File take effect immediately. If you want to undo changes to the host’s File, simply open the File and remove the lines you added or precede the line with a # to ignore it.

Add Host Records

An administrator on Windows systems must open the host’s File. If the host’s File is Fileopened as an administrator, it won’t allow changes to be saved.

To open as an administrator, follow the steps below:

  • Press the Windows key and type Notepad in the search field.
  • Right-click on the Notepad icon and select Run as administrator.
  • In Notepad, click File, thFilepen. In the File name field, paste c:\Windows\System32\drivers\etc\hosts

For example, to add an entry to translate 127.0.0.1 to example.com, open the host’s File and file its entry by scrolling down to the end of the File and add your new entries:

# Copyright (c) 1993-2009 Microsoft Corp.
#
# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
# For example:
#
#      102.54.94.97     rhino.acme.com          # source server
#       38.25.63.10     x.acme.com              # x client host

# localhost name resolution is handled within DNS itself.
#	127.0.0.1       localhost
#	::1             localhost
127.0.0.1               example.com
...

Save the File and exit.

As we said above, the changes take effect immediately. You can use example.com in your browser when you save the File.

CoFilesion:

This is how one adds or modifies Windows 10 host file entries.

Like this:



2 responses to “How to edit the local host file in Windows 10”

  1. Healthtipsing.Com Avatar
    Healthtipsing.Com

    After you add the domain information and save the file, your system begins to resolve to the IP address that you specified. When testing is complete, remove these entries.

  2. Noah F. San Tsorvutz Avatar
    Noah F. San Tsorvutz

    The instructions above fail due to lack of permission. Editing the file is not allowed.

Leave a Reply to Healthtipsing.Com Cancel reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.