How to Block A Specific URL on Windows (No Plugin, All Browsers)

5/5 - (3 votes)

πŸ˜… Would you say it’s possible to invest one minute now to instantly double your productivity?

Watch out. The following trick can make you a productivity animal in no time. Here it is: πŸ‘‡

πŸ›‘ Block all websites that are not leading you towards your goal. Extremely simple but powerful nonetheless.

Here’s how you do it on Windows:

  • Type “Editor” into your search bar.
  • Right-click on the icon and open as an administrator.
  • In the editor, navigate to and open the file "Windows > System32 > drivers > etc > hosts" (can be a .txt or .dat or any other format).
  • Add the line 127.0.0.1 example.com to block the site example.com.
  • Repeat adding lines until you’ve blocked all websites that drain your energy and time.
  • Enjoy killer productivity levels never seen before.

Here’s a small step-by-step video that shows you how to do this…

How to Block a Website in All Browsers - A Helpful 1-Min Guide

Implement this tip today, and you’ll instantly double, if not triple, your productivity. No BS. It’ll take you no time and will be the most profitable minute you’ve ever had. There’s no excuse. Do it now!

Bonus: How to Block a Website on Your Mac? 🍎

A common question from visitors of this blog post is how to do the same in macOS?

Blocking a website on macOS using the hosts file involves redirecting the domain name of the website you want to block to a non-routable IP address, such as 127.0.0.1 (the local loopback address).

Step 1: Open Terminal:

You can find the Terminal application in the Utilities folder within the Applications folder, or you can search for it using Spotlight.

Step 2: Backup your current hosts file (optional but recommended):

In Terminal, type the following command and press Enter:bash

sudo cp /etc/hosts /etc/hosts-backup

Step 3: Edit the hosts file:

Type the following command in Terminal and press Enter:

sudo nano /etc/hosts

This will open the hosts file in the nano text editor with superuser privileges.

Step 4: Add the websites you want to block:

Scroll to the bottom of the file.

On a new line, type 127.0.0.1 followed by a space, and then the domain name of the website you want to block. For example:

127.0.0.1 www.facebook.com 

If you want to block multiple websites, add each one on a new line:

127.0.0.1 www.example1.com 
127.0.0.1 www.example2.com

Step 5: Save and exit:

  • Press Control + O to save the file.
  • Press Enter to confirm.
  • Press Control + X to exit the nano editor.

Step 6: Flush the DNS cache:

To ensure that your changes take effect immediately, you should flush the DNS cache. Type the following command in your Terminal and press Enter:

sudo dscacheutil -flushcache

Step 7: Test the changes:

Open a web browser and try to access the website you blocked. It should be inaccessible. Here’s an example where I blocked chess.com:

Step 8: Revert changes (if needed):

If you ever want to unblock the websites or revert your changes, you can either manually remove the entries from the hosts file or restore from the backup you created in step 2. To restore from the backup, use the following command in Terminal:

sudo cp /etc/hosts-backup /etc/hosts

⚑ Blocking websites using the hosts file is a system-wide change, so it will affect all users on the computer.

Also check out our recommended blog post:

πŸ›‘ Recommended: Block Websites Using Python in Windows

Also, you may want to remove ads completely from your browsing experience to boost your productivity even further.