Blocking Access to a Website

Many users often find themselves needing to block access to a certain website for various reasons. This could be due to encountering a virus on the site, wanting to protect children from inappropriate content, or even restricting access to social media sites in a corporate setting. Here’s a straightforward method to block access to websites using the hosts file on your computer.

Step-by-Step Guide:

  1. Locate the Hosts File:
    • Open a text editor as an administrator.
    • Go to C:\Windows\System32\drivers\etc.
    • Look for a file named hosts.
    • Open the hosts file in the text editor.
  2. Add Entries to Block Websites:
    • To block a website, add a new line at the end of the hosts file.
    • Start the line with
    • After, press the spacebar once and then type the domain name of the website you want to block.
    • For example:
  1. Копировать код127.0.0.1 Replace with the actual domain name of the website you want to block.
  2. Save the Hosts File:
    • After adding the website entries, save the hosts file.
    • If you cannot save directly, save the file to your desktop and then replace the original hosts file in the etc folder.
  3. Flush the DNS Cache:
    • Open Command Prompt as an administrator.
    • Type ipconfig /flushdns and press Enter.
    • This clears your DNS cache and helps ensure your computer uses the updated hosts file.
  4. Restart Your Computer:
    • Restart your computer to apply the changes.

Removing the Block:

  • To remove the block from a website, simply open the hosts file again.
  • Delete the line containing the website you want to unblock.
  • Save the file and restart your computer to apply the changes.


Blocking access to websites using the hosts file is a simple method that prevents the computer from accessing specified websites. This method is suitable for basic users, but more advanced users can easily bypass these blocks. Remember, this method only blocks websites on the local computer where the hosts file is modified.