How to edit Hosts file in Windows 11 | Edit hosts file | Block a Domain or a Sub-Domain @tanzTalkstech
How to edit Hosts file in Windows 11 | Edit hosts file | Block a Domain or a Sub-Domain  @tanzTalkstech
Uploaded June 2023 | Updated September 2026, 2 weeks ago
Liked my video? Buy me a cup of coffee!
youtube.com/channel/UCMz232hZ7fD75uGWhuLNjtA/join

Hosts file is used to resolve domain names without using Domain Name System (DNS).

This means that whenever your computer tries to connect to the domain (say) 'www.facebook.com' it will not request DNS for its IP address and instead consider 0.0.0.0 to be the IP address of 'www.facebook.com'

127.0.0.1 is a special address, called loopback IP address and If any public switch, router, or gateway receives a packet addressed to the loopback IP address, it is required to drop the packet without logging the information.

So, we have made domain 'www.facebook.com' unreachable in our example.

Click on like button if you liked the video.


Steps to block domains & subdomains using Windows hosts file:
1. Once you have your Windows hosts file open, enter a comment in your hosts file to organize your mappings of IP addresses to host names
2. To add a comment, make sure you're on a new line and type "#" followed by your comment details. The "#" symbol will tell your computer to ignore anything that comes after "#" on the same line
3. Next, again on a separate line, enter 0.0.0.0 and a space followed by your domain name or subdomain name (website address) to be blocked.

For example:
#Block Facebook
0.0.0.0 facebook.com

4. In the above example facebook.com (domain name) will be blocked by the windows hosts file. To save these entries, navigate to the top left hand corner to file, left click on it and left click on save.

5. Open up your browser and navigate to the website URL address you have just added to your hosts file. The blocked website will now be unreachable meaning that it has been blocked successfully.
‪
‪[Note] Windows hosts file location:
C:\Windows\System32\drivers\etc\hosts

--------

hosts file default contents:

# 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

--------

VirtualBox playlist: youtube.com/playlist?list=PLnisUReSm0-lwVz0CcHg9_NlMY-Vtqd8Y

Install Windows XP on Oracle VirtualBox: youtu.be/4_lUDNetCuc

Set Widescreen 16:9 Resolutions in Windows XP running on VirtualBox: youtu.be/DbrnbiOhHsk

Enable Shared Clipboard and Drag and Drop in Windows XP running on VirtualBox: youtu.be/B8jm5DDwPAo

Install Ubuntu 22.04 LTS in VirtualBox running on Windows 11: youtu.be/C5mJ2SwmN0w

Install macOS Monterey in VirtualBox running on Windows 11: youtu.be/WGrBHjDFVIw

Make Ubuntu Full Screen in VirtualBox on Windows 11 | Fix Screen Scaling in Ubuntu 22.04: youtu.be/w4E1iqsn_wA

Install VirtualBox Guest Additions on Ubuntu 22.04 Guest/Virtual Machine: youtu.be/mGUhjd3D2ZY

Install Oracle Java (JDK) On Ubuntu 22.04 LTS: youtu.be/SMfO5oXNp2g

Install Node.js on Ubuntu 22.04 LTS | Install NodeJS and npm | For React, Web Development: youtu.be/0D1MJf-oscU

Install and Use Visual Studio Code on Ubuntu 22.04 LTS Linux (VS Code): youtu.be/P-yk-AZpcQI

Install Microsoft Windows 11 on VirtualBox: youtu.be/OZbVZdj2c0Q

Make Windows 11 Full Screen in VirtualBox | Fix Screen Scaling | Guest Additions Pack: youtu.be/ahOaKWR8RdA

Install VirtualBox on Windows 11: youtu.be/q0zi-C_NJes
Install Ubuntu 22.10 on VirtualBox in Windows 11: youtu.be/yIWP2js-JoQ
Make Ubuntu Full Screen in VirtualBox | Fix Screen Scaling in Ubuntu 22.10 / Ubuntu 22.04 LTS: youtu.be/Vd3qvG88sS8
Install Linux Mint 21 Cinnamon on VirtualBox | Compute Hash using SHA256 and Verify ISO: youtu.be/lYnZZXVJ6Xc
Make Linux Mint Full Screen in VirtualBox | Fix Screen Scaling in Linux Mint 21: youtu.be/riqEP5WGRs8
Install Ubuntu 23.04 on VirtualBox in Windows 11 | Ubuntu Lunar Lobster: youtu.be/SmS0QJkH-mM
Make Ubuntu Full Screen in VirtualBox: youtu.be/5IYCSJ2EH_o

My Gear:
MSI GL65 Leopard Gaming Laptop
Intel Core i7-10750H 2.6GHz, 10th Gen (6 Cores)
15.6" FHD (1920*1080), IPS-Level 144Hz
16GB DDR4 RAM, 2666Mhz
Nvidia GeForce RTX 2060, 6GB ‎GDDR6
256GB NVMe M.2 SSD + 1TB SATA 7200RPM HDD
Windows 11 Home, 64Bit

#windows11 #tanztalkstech2 #tanzTalkstech #tanzeelosama @tanzTalks.tech2 @tanzTalkstech @TanzeelOAnsari
How to edit Hosts file in Windows 11 | Edit hosts file | Block a Domain or a Sub-DomainDocker Tutorial for Beginners | Install and Learn Docker in 20minutes! Docker UbuntuHow to Clear or Change Directory or Folder Path in Command Prompt of Windows Computer ?Bash Shell Scripting Tutorial 13 - Date Command | Date Time FormatNight Ride through the Roads of #Lucknow ❤️3 In-depth Review and Exploring all the Features & Settings | TP-Link Tapo C500 Outdoor Wi-Fi CameraHow to Upgrade Ubuntu to Ubuntu 23.04 Lunar Lobster using Graphical User Interface | Using GUIWiFi Not Working on Windows 11 | WiFi Problem in LaptopASP.NET Core MVC Project for Beginners | Student Enrollment with Validation & BootstrapHow to Install Ubuntu 23.04 on VirtualBox in Windows 11 | Ubuntu Lunar LobsterWhat is Virtual Machine? How to Install Ubuntu 23.04 on VMware Workstation Player On Windows 111 Tp-Link Tapo C500 Outdoor Budget Wi-Fi Camera | Home Security Wi-Fi Camera | Unboxing
tanzTalks.tech |

How to edit Hosts file in Windows 11 | Edit hosts file | Block a Domain or a Sub-Domain

SHARE TO X SHARE TO REDDIT SHARE TO FACEBOOK WALLPAPER