The Hosts file in Windows is a local text file that maps hostnames to IP addresses. It's most commonly changed to block websites, test servers, or redirect URLs. A lot of pirated and cracked software and games requires entires in the Hosts file to prevent dection methods excaping and rendering the software invalid. However over time, these changes can cause issues so you might need to reset your Hosts file to default. So follow along as we quickly show you how to do it.

Takeaways:

  1. What's the quickest and easiest way to restore Windows hosts file to default.
  2. Download default Windows Hosts File?

What Exactly is the Hosts File on Windows?

The Hosts file helps Windows translate domain names into IP addresses before querying DNS servers. In Windows 11, the default Hosts file typically contains only a few lines, mainly for localhost mapping. Any additional entries are usually added manually or by third-party applications. Incorrect entries can block websites or network services, making it important to restore the default version when problems occur.

# 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

Where to Find the Hosts File

To reset the file, you first need to locate it. The Hosts file is stored in the system directory at:

C:\Windows\System32\drivers\etc\hosts

Because this is a system file, administrative permissions are required to edit or replace it.

How to Reset the Hosts File Back to Default in Windows 11

Follow these steps to restore the default Hosts file safely.

  • Press the Windows key and type Notepad.
  • Right-click on Notepad and select Run as administrator.
  • Confirm the User Account Control prompt.
  • In Notepad, click File > Open.
  • go to C:\Windows\System32\drivers\etc.
  • Change the file type filter to All Files (.).
  • Select the Hosts file and open it.
  • Delete all lines that are not part of the default Hosts file. Make sure it contains only the standard entries for localhost. The example above can be used if you need an example to copy from.
  • Click File > Save and close Notepad. If you get an error while saving, ensure you have administrative privileges and the file is not read-only.

Flush the DNS Cache

To make the changes effective immediately, clear the DNS cache:

  • Press Windows + S and type Command Prompt.
  • Right-click and select Run as administrator.
  • Enter the command: ipconfig /flushdns
  • You will see a message confirming that the DNS cache was successfully flushed.

Alternatively, you can restart your computer, it's easier.