How to edit the hosts file on Windows 10

Editing the hosts file can prevent you from accessing the internet if the file is not modified correctly. This article will guide you on how to edit the hosts file in Windows 10.

You know that DNS resolves domain names like TipsMake to IP addresses, such as 104.24.11.25, but did you know there's a file on a Windows 10 computer that can be overridden? It's called the hosts file and allows users to map specific domain names to a chosen IP address . The hosts file only affects the computer, so you can use it to create custom URLs for IP addresses on your network or redirect certain websites.

As you can imagine, editing the hosts file can prevent you from accessing the internet if the file isn't modified correctly. This article will guide you on how to edit the hosts file in Windows 10.

Note: You need to log in with an Administrator account or have administrator privileges to edit the hosts file.

Edit the hosts file by copying it.

Open the folder containing the hosts file using the following path. If Windows is installed on a different drive, please correct the path accordingly.

C:WindowsSystem32Driversetchosts

Copy the hosts file to another folder or your desktop, then edit it:

Images 1 of How to edit the hosts file on Windows 10

Copy the hosts file back to the original directory and you're done. Click Continue when prompted for administrator privileges.

Images 2 of How to edit the hosts file on Windows 10

Edit the Windows 10 hosts file with administrator privileges.

The hosts file is typically stored in a plain text file in the Windows System folder and can be modified for various use cases. For example, editing the hosts file to block certain websites when creating a computer image for a school. This is perhaps one of the best and easiest ways to ensure students don't access any unauthorized websites like Facebook or YouTube .

In Windows XP and earlier versions, this process was quite easy: just add an exception to the antivirus program , open it in Notepad, make the changes, and then save it.

  • A compilation of useful keyboard shortcuts when using Notepad.

On Windows 10, if you edit the hosts file using Notepad as usual, you will encounter the error "You don't have permission to save in this location. Contact the administrator to obtain permission" when saving.

Images 3 of How to edit the hosts file on Windows 10

Here's how you can edit the hosts file without getting that error message.

Step 1: Open Notepad with administrator privileges: Type "notepad" into the search bar, right-click on Notepad and select "Run as administrator".

Images 4 of How to edit the hosts file on Windows 10

Step 2: In Notepad, click File , then Open. In the File name field , paste the following path into C:WindowsSystem32Driversetchosts:

Images 5 of How to edit the hosts file on Windows 10

Alternatively, you can select "All Files" in the file type, and you'll see the hosts file at the top:

Images 6 of How to edit the hosts file on Windows 10

Images 7 of How to edit the hosts file on Windows 10

Step 3: Now you can edit and save the changes to the hosts file.

Images 8 of How to edit the hosts file on Windows 10

To map a domain, simply add a line based on the examples in the hosts file. Start with the IP address, then a space, then the domain name. If you want to block a website , redirect it to 127.0.0.1 .

Remember to remove the '#' before the URL if you want the changes to take effect. Also, remember that www.youtube.com is different from youtube.com, so to be sure, you should add both websites to your hosts file. You need to restart your computer for the hosts file to take effect.

An easier way to edit the hosts file in Windows 10.

If you find the above process a bit cumbersome, there is a third-party utility you can use to modify the hosts file, such as Hosts File Editor by Scott Lerch.

Here's how to edit the hosts file using Hosts File Editor. Download the 1MB installer to your computer and install it. Remember to select the option that only allows you access if you don't want other users to have access to it.

Images 9 of How to edit the hosts file on Windows 10

Launch the app from Start > All apps ; this will add the app to your Notification area so you can launch the editor whenever you need it.

Images 10 of How to edit the hosts file on Windows 10

Hosts File Editor has a clean, user-friendly interface. To start using the program, fill in the IP Addresses , Host Names , and Comments fields for the websites you want to manage. It's not limited to popular internet websites; even devices on your home network with IP addresses can be managed, so Xbox, iPad, webcam, or router can easily block access if needed.

Images 11 of How to edit the hosts file on Windows 10

When you're ready to block a website, select the boxes for the websites you want to block, click Save , and save it.

Images 12 of How to edit the hosts file on Windows 10

Another user-friendly feature is the ability to simply right-click on the Hosts File Editor in the Notification area, then click on Disable Hosts File or perform quick edits, without having to search for or launch the command line anymore.

Images 13 of How to edit the hosts file on Windows 10

There are some great features for skilled users and network administrators, such as:

  • Cut, copy, paste, duplicate, enable, disable, and move one or more items at a time.
  • Filter and sort when there are multiple hosts entries.
  • Save and restore different hosts file configurations when switching between environments.
  • Automatically ping the terminal to check availability.

What happens if the hosts file cannot be saved?

In some versions of Windows, you don't have permission to save directly to the etc. folder. If that's the case, you might encounter an error like the following when trying to save a file:

  • Access to C:WindowsSystem32driversetc hosts was denied. ( Access to C:WindowsSystem32driversetc hosts )
  • Cannot create the C:WindowsSystem32driversetchosts file. Make sure that the path and file name are correct .

Instead, you must save the file elsewhere, such as in the Documents or Desktop folder. After saving, navigate to that folder, copy the hosts file, and paste it directly into the location containing the hosts file (C:WindowsSystem32driversetc). You will be prompted for permission verification and will have to confirm overwriting the old file.

Note : If you are still having trouble saving the modified hosts file, check the file's properties to see if it is marked as read-only. Right-click the file and select Properties to view the properties.

Another option is to open your text editor with administrator privileges, so that the permissions are applied to that editor. Next, saving the hosts file on the original can be done without needing to verify your administrator login credentials.

If you still can't save to the hosts file location, you may not have permission to edit the files in that folder. You need to log in with an account that has administrator privileges for the hosts file; you can check this by right-clicking the file and going to the Security tab.

Close
Category

System

Windows XP

Windows Server 2012

Windows 8

Windows 7

Windows 10

Wifi tips

Virus Removal - Spyware

Speed ​​up the computer

Server

Security solution

Mail Server

LAN - WAN

Ghost - Install Win

Fix computer error

Configure Router Switch

Computer wallpaper

Computer security

Mac OS X

Mac OS System software

Mac OS Security

Mac OS Office application

Mac OS Email Management

Mac OS Data - File

Mac hardware

Hardware

USB - Flash Drive

Speaker headset

Printer

PC hardware

Network equipment

Laptop hardware

Computer components

Advice Computer

Game

PC game

Online game

Mobile Game

Pokemon GO

information

Technology story

Technology comments

Quiz technology

New technology

British talent technology

Attack the network

Artificial intelligence

Technology

Smart watches

Raspberry Pi

Linux

Camera

Basic knowledge

Banking services

SEO tips

Science

Strange story

Space Science

Scientific invention

Science Story

Science photo

Science and technology

Medicine

Health Care

Fun science

Environment

Discover science

Discover nature

Archeology

Life

Travel Experience

Tips

Raise up child

Make up

Life skills

Home Care

Entertainment

DIY Handmade

Cuisine

Christmas

Application

Web Email

Website - Blog

Web browser

Support Download - Upload

Software conversion

Social Network

Simulator software

Online payment

Office information

Music Software

Map and Positioning

Installation - Uninstall

Graphic design

Free - Discount

Email reader

Edit video

Edit photo

Compress and Decompress

Chat, Text, Call

Archive - Share

Electric

Water heater

Washing machine

Television

Machine tool

Fridge

Fans

Air conditioning

Program

Unix and Linux

SQL Server

SQL

Python

Programming C

PHP

NodeJS

MongoDB

jQuery

JavaScript

HTTP

HTML

Git

Database

Data structure and algorithm

CSS and CSS3

C ++

C #

AngularJS

Mobile

Wallpapers and Ringtones

Tricks application

Take and process photos

Storage - Sync

Security and Virus Removal

Personalized

Online Social Network

Map

Manage and edit Video

Data

Chat - Call - Text

Browser and Add-on

Basic setup