The Windows Hosts file is a tệp tin that Windows uses to control and map IP addresses. By editing the Hosts file, Windows can be customized to lớn block or redirect specific websites & even protocols that are used by programs và applications.

Bạn đang xem: Macos

In this article, we’ll walk you through the steps to lớn correctly edit the HOSTS file. Also, if you would rather watch a video of the process, feel free to kiểm tra out our YouTube video.


From this prompt, you can choose lớn edit the hosts file with Notepad. So, simply click to lớn select Notepad and click the OK button. From there, Notepad will launch with the hosts file information.


This way of opening the hosts tệp tin was demonstrated khổng lồ show where the hosts file is actually located within Windows, but you won’t be able khổng lồ edit it because it’s a system file. In order khổng lồ edit the file, you have to open Notepad first, running as an Administrator.

Click on Start và type in Notepad, but don’t click on Notepad to open it. Rather, right-click the Notepad listing to bring up the context menu. Select the option Run as Administrator.


With Notepad open, select File > Open. Navigate toC:WindowsSystem32driversetc. You will geta blank screen that displays the prompt No items match your search. Change Text Documents (*.txt) khổng lồ All Files using the drop down menu. Now, you can select the hosts file and click Open.


Adding files khổng lồ the hosts file is very simple. The hosts tệp tin uses the format:

IP Address

Block Websites using HOSTS File

Blocking a trang web in Windows is as simple as typing the following into the bottom of the hosts file: www.exampledomain.comSo,if I wanted to block a website lượt thích, I could just showroom the following line:


What we are actually telling Windows is that the trang web should redirect to lớn the IP address, which is just the loopback address on our local system. If you don’t have a local website thiết lập on your computer, you’ll just get an error page in your website browser.

Xem thêm: Tinh Hoa Nghệ Thuật Gốm Thời Lê, Tinh Hoa Nghệ Thuật Gốm Hoa Lam Thời Nhà Lê


Pretty cool, huh!? Obviously, you can see how this can be used in several different ways: a prank, parental control, etc. If you didn’t want to block the trang web in that way, you could also redirect it khổng lồ another website. In order to vày this, you have to find the IP address of the other site first.

To vị that, just xuất hiện a command prompt (click on Start and type in CMD) & type in the following command:

In my example, I pinged The IP address is Now I can simply plug that number into my hosts file in front of

Now when I visit, I get redirect to! Nice! chú ý that if this doesn’t work for the websites you are entering, it could be because of the URL you are using. For example, it makes a difference if you use as opposed to without the www. Visit the website & see exactly what the URL is for the trang web you want khổng lồ redirect. You should always try without the www first lớn see if that works.

If the trang web uses HTTPS like or something, it should still redirect if you use the host name. There is no way to specify the HTTPS version of a website in the HOSTS file, but it should redirect the HTTPS and non-HTTPS versions of the trang web if you use just the host name (i.e.

Lastly, you can use the hosts tệp tin to create simple shortcuts to your own devices on the network. For example, my router is at on my trang chủ network, but I could địa chỉ cửa hàng the following line khổng lồ my hosts file và simply type in into my address bar.

It doesn’t really matter if is actually a website or not because the hosts tệp tin is read first & you are redirected to lớn the IP address specified in the file. It’s worth noting that not all browsers may use the hosts file, so if it’s not working, that could be the issue. I tested it using IE, Microsoft Edge, Chrome và Firefox và it worked on all of the browsers.

Overall, the hosts tệp tin is still useful, even in Windows 10. It also still works just fine in Windows 8, 7, Vista, etc. If you have any questions, feel không tính tiền to comment. Enjoy!