What is the Hosts file for?
The purpose of this system file is to assign certain website addresses to a specific IP.
This file is very popular with all kinds of viruses and malware in order to write their data into it or simply replace it.
The result of these actions may be signs of “insertion” of a site into browsers, which will ask to send an SMS when opening the browser, or blocking of various sites, at the discretion of the creators of the virus.

Where is hosts file in windows?
For different OS versions Windows location hosts file is slightly different:

Windows 95/98/ME: WINDOWS\hosts
Windows NT/2000: WINNT\system32\drivers\etc\hosts
Windows XP/2003/Vista/Seven(7)/8: WINDOWS\system32\drivers\etc\hosts


Moreover, the ending hosts, this is already the final file, not a folder. He doesn't have it.

What it should look like correct file hosts?
The "contents" of the hosts file are also slightly different for different versions windows, but not really. It is "written" in English language why it is needed and how to make exceptions with one example. All lines starting with a # sign mean that they are commented out and do not affect the file.
Contents of the original hosts file for Windows XP:


#

#




#space.
#


#
# For example:
#



127.0.0.1 localhost


Contents of the original hosts file for Windows Vista:

# Copyright (c) 1993-2006 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
127.0.0.1 localhost::1 localhost


Contents of the original hosts file for Windows 7:

# 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 handle within DNS itself.
# 127.0.0.1 localhost
# ::1 localhost


Contents of the original hosts file for Windows 8:

# 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


As you can see, there are no significant differences in the contents of the host file for different versions of Windows.

How to open and edit the hosts file?
The hosts file can be found in standard Windows Notepad.
This is probably the most interesting part of the article.
First of all, you need to understand why change this file at all? Yes, in order to deny access to certain sites. Thus, by changing this file and having entered the site address into it, the user will not be able to access it through any .
In order to change the hosts file, it is advisable to open it as administrator () by right-clicking on the file and selecting "Run as administrator". Or open Notepad this way and open the file in it.

For quick action, you can simply click the Start button and select Run ( win+r) () and enter in the line:

notepad %windir%\system32\drivers\etc\hosts



As a result, this file will open in Notepad.

In order to block access to the site(let's assume it will be test.ru), you just need to add a line with this site at the very bottom:

127.0.0.1 test.ru


As a result, the file will have the following content:

# Copyright (c) 1993-1999 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

# This HOSTS file created by Dr.Web Anti-rootkit API

# 127.0.0.1 localhost
# ::1 localhost
127.0.0.1 test.ru


Every new site you want to block must start with new line and register, not forgetting the local IP address 127.0.0.1

Also, to edit the hosts file, there is a program HOSTS EDITOR, which you can download and read the description from.
The way it works is that it helps edit the hosts file.
From the screenshot below the principle of its operation is clear; everything is done in a couple of clicks. Adding is done by clicking on +.


After editing, do not forget to click on the save button (2 button "Save changes" to the left of the "+" button).

You can also change this file for good purposes, for example speed up site loading.
How it works?
When you access the site, you see it Domain name, which has letters. But all sites on the Internet have an IP address, and names are already assigned using DNS. I won’t go into details of this process; that’s not what the article is about. But here you need to know that the hosts file has priority when accessing sites, and only after it does a request to DNS occur.
In order to speed up the loading of a site, you need to know its IP address and domain.
The IP address of a site can be found using various services, for example or.
A domain is the name of a website.
For example, let's speed up the loading of this site where you are reading an article by explicitly specifying the IP address and domain to the file.
Then the added line will be:

91.218.228.14 website


This speeds up page loading in a couple of seconds, and sometimes can give access if standard means You cannot access the site.

Still possible redirect to another site using hosts file.
To do this, you need to know the IP address of the site and its domain (as in the case described above), then the added line will be like this:

91.218.228.14 test.ru


And now, after entering address bar browser of the site test.ru, you will be redirected to the site specified in the IP address..

If you want to clean hosts file, then you can do this by simply deleting the content and inserting the original text from the description above (under spoilers).

Some nuances in the hosts file:

  • Always make sure you have a scroll bar on the side and always scroll to the bottom of the window. This is due to the fact that some viruses are registered in an area hidden outside the window.
  • In some cases, usually if you can’t save the file, you need to log in account Administrator.
  • Sometimes, due to viruses, this file may be hidden. Read the article.
  • The two methods described (redirection and acceleration) may not produce the desired result. The fact is that several sites can be located on one IP address, this is especially true for external IP addresses provided by services.
  • Due to the fact that viruses love this file, its attributes can be changed to Hidden And Read-only.
  • Check the file attributes if the hosts file cannot be saved.

    Thus, you can easily and free of charge block access to sites in Windows by editing the hosts file.

  • Vladimir Skesov

    Well, I think you have already noticed that when you try to save a system file hosts(C:\Windows\System32\drivers\etc\hosts), the new operating system complains and does not allow you to save the desired changes. This is to blame for the tightening of security rules applied in the eighth series operating systems. Of course, this makes sense, since many viruses write the lines they need into this file, and all antiviruses have long been required to check this file for these changes. But what should we, ordinary users, do? We want, for example, to simply turn off advertising in Skype. It's quite simple: we need to open this file in a program running as administrator. And there are several ways to do this:

    I. Editing the hosts file using the command line.

    1) Click right key in the lower left corner and select " Command line(Administrator)":

    2) In the window that opens, write (or copy) the following text:

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

    3) The most common Windows notepad will open, but it will be launched with administrator rights and will allow you to make changes to the hosts file:

    An alternative to the first method:

    Download the editHOSTS.cmd file. Right-click on it, select “Run as administrator” and edit the file in the notepad window that opens.

    II. Open a text editor with administrator rights manually.

    1) Fundamentally this method is no different from the previous one, but now we need to go to the folder in which the executable file of the text editor is stored, for example Windows Notepad (this part of the instructions will also work for other text editors, for example Notepad++) is located in:

    C:\Windows\system32

    In this folder you need to find the file notepad.exe:

    2) Click on notepad.exe right-click and select "Run as administrator":

    3) Select "File" → "Open". In the window that appears, go to the folder with the file hosts(C:\Windows\System32\drivers\etc\). Select "All files" in the lower right corner and open

    1. What are hosts for?

    The task of the system hosts file is to store a list of domains (web addresses like site.ru) of various sites and their IP addresses. Thus, in the process of working with the Internet, domains are converted into their IP addresses and vice versa. Each outgoing request to open a particular Internet site is, in fact, a request to convert a domain to an IP address. This query is performed by the Internet DNS service. From the technical side of the Internet veil, there are no web addresses in literal expression like site.ru. They are used for the convenience of web surfing by users and reflect the essence of the site's themes. Designed to facilitate the exchange of data between different parts of the network, the DNS service converts domains into specific sets of numbers, also known as the IP addresses of each individual site.

    The hosts file has priority over the DNS system. Before accessing this Internet service, browsers first check their cache, then receive information about the correspondence of IP addresses to domains, which is contained in the hosts file of the operating system Windows systems. And only after this the request goes to DNS.

    Some users make changes to the “hosts” in order to speed up the loading of their favorite sites. If you specify in it for individual sites the correspondence of IP addresses to their domains, you can get slightly faster access to these sites, since they will load in the browser window, bypassing the stage of sending a request and receiving data from the DNS service. But this method of optimizing Internet access is not necessary, since there is a browser cache with the highest access priority.

    The need for intervention to change the contents of this file arises when it is edited by malware without the user’s knowledge. Hosts file - vulnerable Windows place, it is of particular interest to malware creators. Replacing the original system file hosts to its analogue, but with a ready-made list of false correspondences of IP addresses to their domains, Internet fraudsters thus implement a redirection mechanism that is beneficial to them. If you add a false correspondence to the IP address to the domain in “hosts”, replacing real IP address, for example, some social network to the IP address of, say, a site with paid porn content, accordingly, every time we try to get to the social network, we will actually end up on a porn site. But this is not the worst example of scammers manipulating hosts. Things will be much more difficult with filling out forms on phishing sites. In order to fish out confidential user data, for example, accounts in financial and online payment systems, logins and passwords for them, Internet fraudsters can replace individual web pages of these online systems with their own web pages, specially created for fraudulent purposes. Substitution of file data with redirection to another site is also used as a dishonest way to promote sites, to block social network pages and extort money for unblocking money, to block access to antivirus web resources software products and so on.

    Making changes to hosts is also practiced for the purpose of locally blocking access to certain sites. For example, within the framework of parental control.

    Below we will look at how the processes of making changes to hosts are carried out in order to edit it to block individual sites, as well as to correct it if the content is replaced by malware. But first, of course, let’s find the file itself, open it and look at its original contents.

    2. Path to the hosts file and opening it

    To access hosts, you must have administrator rights. It is located in the Windows system directory along the path:

    C:\Windows\System32\drivers\etc

    You can also open this path with the command %systemroot%\system32\drivers\etc in the Run dialog box

    To open a file, call on it context menu, select “Open with” (just “Open” for Windows 7) and from the list of offered programs select the standard Windows notepad or any third-party notepad, if one is present in the system (Notepad++, AkelPad, etc.).

    If according to specified path(subject to the display parameter being set hidden folders and files in Explorer) there is no “hosts” file, this is a clear consequence of the tricks of malware that has penetrated the computer. Viruses and Trojans can sometimes move it to another location on the computer.

    3. Contents of hosts

    After opening hosts, we will see its contents in the form of informational information about the essence of this file. Of the correspondence between IP addresses and their domains, only one working record should be present in the original edition of the file contents (without user intervention, without malware tricks). This is a disabled mapping of the current computer's IP address to the value "localhost", the local host. The hash sign at the beginning of the line means that the prescribed correspondence does not affect anything, but simply exists in the prospect of being used or as a template.

    4. Blocking access to individual sites using the hosts file

    Editing “hosts” is one of the many ways to block access to individual sites. Against the background of the locking mechanisms offered by the regular parental control Windows and third party programs, editing hosts is simple and in a fast way restrictions on access to sites.

    To block access to a specific site, first clear the cache of the browsers used on the computer, then open the hosts in notepad below existing records enter a redirection from unwanted sites to the local host like:

    127.0.0.1 site1.ru

    127.0.0.1 site2.ru

    127.0.0.1 site3.ru

    Those. in each match, after the local IP address 127.0.0.1, we add the domains of unwanted sites separated by a space. After editing the contents of the file, click the menu “File” - “Save As”.

    It will not be possible to save the newly created file directly along the path where it is located in the system directory. First, this file must be saved in any non-system folder (for example, in the “Documents” folder) as a regular one text txt file with the name "hosts".

    After saving, select this file, press the rename key F2, delete the “.txt” extension (along with the period) and press Enter.

    We confirm the action.

    We copy the newly created file, after which we go to the folder along the path of the original hosts file, which is indicated in paragraph 1 of the article. Before inserting the newly created hosts file, you need to decide what to do with this file in its current edition. As an alternative to deleting, you can use the same F2 key to rename the current file, adding a postscript to the name in the form of a serial number, date or other nuances. It will be something like backup copy hosts with some current settings, which you can always return to by giving the file the original name without a postscript.

    We confirm the insertion of the new file with administrator rights.

    After all these steps, the sites included in the blocking list will not open in any browser on the system.

    In the future, to temporarily remove the lock, so as not to delete entire records, you must insert a pound sign at the beginning of the line of each individual match and save the hosts file as indicated above.

    It is not recommended to create a huge list of blocked sites (more than a hundred) in hosts, so as not to slow down the operation of your computer with the Internet. When blocking large-scale web projects such as social networks, you must also take into account that they may be accessible not by one domain, but on several.

    5. How to fix the hosts file

    If, when you try to visit the desired site, some other one opens instead, or a message appears demanding money for unblocking a social network account, it’s time to fix the hosts. First, of course, you need to clean your computer from viruses and other malware. Only after this can you begin to correct the file. Fixing hosts means that you need to return its contents to original state. There are several ways to do this.

    One way to fix it is manual removal strings of false matches of IP addresses to domains that were introduced by malware. Having opened the file in Notepad, we leave only the default matches, as indicated in the screenshot, and delete all other lines.

    And save the file as indicated in the previous paragraph of the article.

    Records with false matches may be hidden from view standard view Notepad window, so you need to view the entire document by scrolling down to the very end.

    Another option for fixing a file is to completely replace the existing content with the original text content. The source text of the file can be copied from the Microsoft support site, where options for different versions and Windows editions:

    In the case of Windows 10, a variant of the source text of the hosts file for Windows 8.1 is used.

    We copy the original contents of the file on the website, in Notepad press Ctrl+A to select the entire text of the document, then Ctrl+V to paste. We save the file as indicated in the third paragraph of the article.

    If the file in the path specified in the first paragraph of this article is missing, it must be created there after neutralizing the malware. Open in notepad new document, paste copied on the site Microsoft support source text, save the file and place it in the system directory where it should be.

    Finally, last method file corrections are automatic. True, it is only available for Windows 7 and earlier versions of the system. By following the link above, on the Microsoft support website in the “Easy fix” block, download the Fix it utility.

    We launch it, agree to the license terms, click “Next”.

    We wait for its completion and close it.

    Reboot the computer.

    The utility will automatically correct hosts and return its contents to its original state, including restoring the file if it was not found along the installation path due to malware tricks.

    Have a great day!

    When connecting to a website, your computer first contacts the DNS domain name server and requests the IP address of the desired site. For example, the website Facebook.com has an IP address of 66.220.158.70. Your computer then connects to the identified IP address and accesses the site.

    Your hosts file is a file local to your computer that can modify the above behavior. By editing the hosts file, you can “bind” Facebook.com to any IP address you want. Some people use this trick to block websites.

    So, for example, you can link Facebook.com to the address 127.0.0.1, which is your local IP address. Subsequently, when someone tries to access Facebook.com from your computer, your computer will try to connect to itself. However, it will not find your web server, and therefore there will be no connection.

    In a similar way, the connection of programs to activation servers is blocked so that “wrong” keys found on the Internet do not stop working.

    Why did Microsoft change how it works with the hosts file?

    Unfortunately, the hosts file is often edited malware, adding various lines to it. So, for example, a Trojan can “link” Facebook.com to a completely different IP address, where a specially prepared hacker server, which can impersonate the real Facebook.com. The user will see the name Facebook.com in the address bar and will never even realize that they are on a phishing site.

    To prevent this, Windows 8 (or more accurately Windows Defender in Windows 8) monitors your hosts file. When you add any site to it, like vk.com, the operating system immediately deletes new entry and thereby ensures your connection to the normal site vk.com.

    For many users this behavior operating system very important, because it is aimed at their own safety. However, if you like to do everything yourself, you can disable tracking changes to the hosts file.

    Since Windows Defender monitors hosts file changes, you can:

    • Exclude hosts file from Windows Defender tracking. This best way. However, using it will mean that Windows will no longer protect your hosts file from being modified by malware.
    • Install an antivirus from a third-party developer. Many third party antiviruses won't be as aggressive with your hosts file. When you install a third-party antivirus, Windows Defender will turn itself off.

    You can also disable Windows Defender completely, but this is not very good idea(unless, of course, you install a third-party antivirus after this). Even as a cautious user, having multiple layers of protection is a good security practice.

    Excluding the hosts file from Windows Defender tracking

    To exclude the hosts file from being tracked by Windows Defender, first open Windows Defender itself. To do this, enter in Windows search Defender.

    On the left, select Windows Defender from the search results and open the application.

    On the Options tab, in the Excluded Files and Locations section, click the Browse button and navigate to the following file:

    If you installed Windows in a different folder, start there instead of C:\Windows.

    Click on the “Add” button and save the changes.

    Now you can edit your hosts file, and Windows will not ignore the changes you made.

    Editing the hosts file

    You will have to edit the hosts file as an administrator. If you try to edit it in the usual way, when saving you will see an error message saying that you do not have sufficient rights.

    To run Notepad as administrator, click on it right click mouse and from the menu that appears, select the option to run as administrator.

    By the way, you can also use any other editor, like Notepad++, to edit the hosts file.

    In the editor, click on the File -> Open menu and navigate to the following file:

    C:\Windows\System32\Drivers\etc\hosts

    In the file selection window that opens, you need to select the “All files” option from below, otherwise you will not see the hosts file.

    After opening the file, add your own line for each site to be blocked. Type 127.0.0.1 then press the spacebar or tab and then write the name of the website. So, for example, the following lines will block facebook.com and vk.com:

    127.0.0.1 facebook.com

    127.0.0.1 vk.com

    After editing, save the file. The changes will take effect immediately and websites will be blocked - no system reboot required.

    That's all! Good luck to you!

    The article covers the following questions: where is the hosts file in Windows 7, Windows 8, Windows 10; contents of the hosts file, how to edit it; how to save the hosts file if access is denied.

    Hosts file - what is it, what is it for?

    What is this

    hosts - a file containing a database of IP addresses and domain names corresponding to them. For example, for the popular site VKontakte the correspondence will be as follows:

    87.240.131.118 vk.com

    The hosts file on Windows is opened using the application Notebook.

    What is it needed for

    Letter website addresses were invented exclusively for people, since it is easier for a person to remember. Computers find sites by numbers. Using the same VKontakte as an example: vk.com is a letter address (or they say URL), and 87.240.131.118 is a digital address (or IP address).

    Check my words. Enter in the address bar of your browser
    87.240.131.118
    You must go to the site https://vk.com/.

    All matches between IP addresses and URLs are stored on DNS servers, which the browser contacts and opens to us the desired site.

    But before contacting the DNS server, the browser always checks the hosts file. In it we can prohibit the opening of sites, or replace the correspondence between the IP address and the URL.
    This is what viruses do on the computer, replacing matches, adding other lines to this file, etc. For information about the lines that need to be entered into such a file, see the chapter “Like commands that need to be entered

    What should the hosts file look like? Contents of the hosts file

    The hosts file should have the following:

    For Windows XP:

    # Copyright (c) 1993-1999 Microsoft Corp.
    #

    #




    #space.
    #


    #
    # For example:
    #

    127.0.0.1 localhost

    For Windows Vista:


    # Copyright (c) 1993-2006 MicrosoftCorp.
    #
    # 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


    # 127.0.0.1 localhost
    # ::1 localhost

    For Windows 7, 8, 8.1, 10:

    # 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 is the hosts file located in Windows 7, Windows 8, Windows 10

    The hosts file is located in all versions of Windows at
    See screenshots:

    How to open the hosts file

    This file can be opened using Notepad. Find it in the start menu this application. Right-click. In the menu that appears, select “Run as administrator.” In the Notepad window that opens, through the “File” → “Open…” menu, open the hosts file, writing the file address in the address bar of the window that opens or moving from folder to folder until we find it.

    How to edit the hosts file

    1. Recovery

    To restore a file you need:
    1. Open the file using Notepad as administrator.
    2. Copy the contents of the file from this article, paste with replacement and save.
    Attention!
    The file should only be opened through Notepad running as administrator. Otherwise, you will not be able to save the changes. When we save the .txt extension in the file name, we remove it.

    Tricks of a modified hosts file

    1. Some viruses disguise their changes after lines
    127.0.0.1 localhost
    ::1 localhost

    They leave a lot of spaces and only then add lines.

    Therefore, when replacing content, select all content (hot keys CTRL+A).

    2. The file is hidden
    If there is no file in the specified package, then it may have been hidden and assigned the “Hidden” attribute.
    In the menu View → Options → View, check the box “Show hidden files, folders and disks."




    Now that the file has appeared, in the file properties, uncheck the “Hidden” checkbox.

    3. Cannot be edited
    The file has been assigned the Read Only attribute. In the file properties, uncheck the corresponding box.


    To folder C:\Windows\System32\drivers\etc place a file with the name hosts, but with the extension .txt(hosts.txt file) or without an extension, like the hosts file, but with a different name, for example, host.

    2. Change

    To block access to a certain site, you need to enter the lines at the end of the content
    (Skip line)
    127.0.0.1 (several spaces) (Domain name to block)
    127.0.0.1 (several spaces) (Name of the blocked domain from www.)

    Using the example of the same VKontakte and Odnoklassniki:


    Save. We check our work by entering the URL of these sites into the address bar of the browser. Sites do not open. Bingo!

    This way you can block websites computer games, casino sites, pornographic sites, etc.

    To redirect, we do everything as before, but we give the desired URL a different IP.

    Example. Let the site https://vk.com/ open when you log in to VKontakte and Odnoklassniki
    We write the lines:
    (Skip line)
    87.240.131.118 vk.com
    87.240.131.118 www.vk.com
    87.240.131.118 ok.ru
    87.240.131.118 www.ok.ru

    2.3. Popular sites and their IP addresses

    87.240.131.118 https://vk.com/
    213.180.193.3 https://ya.ru
    5.61.23.5 https://ok.ru/

    The Internet is full of services to determine the IP addresses of any websites. Google it.

    hosts access denied - what to do

    If you cannot save the file and access is denied. We do it in order, trying to save the file after each item.
    1. Open in Notepad as administrator.
    2. Copy the file to your desktop. Change it. The hosts file remaining in the folder C:\Windows\System32\drivers\etc rename it to hosts.old. Copy the hosts file you edited on your desktop to the folder C:\Windows\System32\drivers\etc.
    3. Turn off antivirus. Antivirus programs often ensure that no changes are made to this file. Add file to exceptions Windows Defender. Starting at 8 Windows versions makes sure that no one changes this file.
    4. We set access rights to the file in its properties on the “Security” tab.
    5. If you still can't remove it, go to Safe Mode and try to remove it from under it.

    What happens if you delete the hosts file

    Nothing will happen. Unless there are problems with your Internet connection. During connection, the IP address 127.0.0.1 will have to be specified manually. It's possible that some programs will ask for localhost instead of 127.0.0.1, which will create another problem.