Can you recommend me a web blocker for Windows 7? I want it to avoid procrastination surfing for the web, but at the same time I need to block only some websites, not all and for some hours. For example, I want to be able to visit Stack Overflow, but I want to not be able to visit Reddit.

It can't be a browser addon because I run virtual machines inside Windows 7, and I want this VMs to be also blocked.

  • 1
    Too many suggestions to muck with the hosts file, when it sounds like OP wants something more like ColdTurkey (although I do not recommend that one, it would be nice to know of alternatives)
    – Ben Voigt
    Commented Feb 15, 2015 at 21:42
  • If you didn't mind sticking to Firefox you could use the awesome Leechblock which lets you limit certain sites to so many minutes per hour or day etc proginosko.com/leechblock.html Commented Feb 16, 2015 at 0:36
  • 1
    I've also found it useful to use a password manager like Password Safe to generate random passwords for me, so I don't know the password to login to Facebook etc and have to go and get it from Password Safe. That extra effort means I'm less likely to login to Facebook on browser's other than Firefox. Commented Feb 16, 2015 at 0:43
  • @BenVoigt See my answer about OpenDNS. Seems to be some kind of alternative to ColdTurkey.
    – Marcel
    Commented Feb 16, 2015 at 7:06
  • @Marcel: OpenDNS seems a good solution if you are looking for a parental control, but I don't think it's an alternative to ColdTurkey. I want something local (I only want to alter my computer, not my wife's computer or my mobile), and I don't want something permanent, I want it to work only some hours each day.
    – mHouses
    Commented Feb 16, 2015 at 7:12

8 Answers 8


You can use Hosts-Switch to switch between different hosts files:

  • gratis
  • Windows
  • allows switching between different hosts files with a shortcut.

enter image description here

  • I found that editing the host file was the best solution (cross browser, etc). But I find somewhat limited to the domain. For example I cannot block news.google.com without blocking google.com.
    – borjab
    Commented Feb 16, 2015 at 9:44
  • @borjab How about news.google.com ? Commented Feb 16, 2015 at 14:44
  • Sorry. I talked by memory. Google news uses a get http parameter "&tbm=nws" or "google.com/news/" and that is the hard part.
    – borjab
    Commented Feb 16, 2015 at 15:27
  • The problem using the hosts file is how to block, for example, *.google.com, or *.stackexchange.com
    – mHouses
    Commented Feb 17, 2015 at 12:17
  • 1
    @mHouses The hosts file indeed doesn't support wildcards. One way around is to have the hosts file point to Acrylic DNS Proxy (gratis and open-source), which supports wildcards. Commented Feb 17, 2015 at 13:27

You could use a proxy server, such as squid.

Squid is a caching proxy for the Web supporting HTTP, HTTPS, FTP, and more. It reduces bandwidth and improves response times by caching and reusing frequently-requested web pages. Squid has extensive access controls and makes a great server accelerator. It runs on most available operating systems, including Windows and is licensed under the GNU GPL.

See How to block website using SQUID server, for information on how to do this. Reproducing the answer below:

You have to do some changes in squid.conf and here are the steps:

  • open this file /etc/squid3/squid.conf

  • add these lines:

    acl bad_url dstdomain "/etc/squid3/bad-sites.squid"
    http_access deny bad_url
  • then go to /etc/squid3/bad-sites.conf and add domains with this format


A lot of the answers here are referencing the almighty hosts file, and indeed, that is your best bet. Here's an automated solution provided by some smart guys over at StackOverflow that utilizes no third party software. You can bundle this up into a batch file and run as a Windows task that unblocks at certain times and completely forget about it.

This approach has several upsides:

  • Simple
  • Free (no downloads required)
  • Easy to schedule times with Windows Task Scheduler
  • OS level blocking of websites
  • Enough of a hassle to undo that you will probably stop yourself before you go through with it.

Here's the code for the batch files:

code for blockfacebook.bat

echo www.facebook.com >> c:\windows\system32\drivers\etc\hosts

code for unblockfacebook.bat

@echo off
    setlocal enableextensions disabledelayedexpansion

    set "file=c:\windows\system32\drivers\etc\hosts"

    for /f "tokens=* delims=0123456789" %%a in (
        'findstr /n /i /v /c:"facebook" "%file%" ^& type nul ^> "%file%"'
    ) do (
        set "line=%%a"
        setlocal enabledelayedexpansion
        >>"%file%" echo(!line:~1!


Just copy paste these into Notepad and save with the .bat extension and double click on them to test.

Scheduling a task:

from Microsoft's website:

You must be logged on as an administrator to perform these steps. If you aren't logged on as an administrator, you can only change settings that apply to your user account.

If you use a specific program on a regular basis, you can use the Task Scheduler wizard to create a task that opens the program for you automatically according to the schedule you choose. For example, if you use a financial program on a certain day each month, you can schedule a task that opens the program automatically to avoid the risk of forgetting to open it yourself.

  1. Open Task Scheduler by clicking the Start button Picture of the Start button, clicking Control Panel, clicking System and Security, clicking Administrative Tools, and then double-clicking Task Scheduler.‌ Administrator permission required If you're prompted for an administrator password or confirmation, type the password or provide confirmation.

  2. Click the Action menu, and then click Create Basic Task.

  3. Type a name for the task and an optional description, and then click Next.

  4. Do one of the following:

    • To select a schedule based on the calendar, click Daily, Weekly, Monthly, or One time, click Next; specify the schedule you want to use, and then click Next.

    • To select a schedule based on common recurring events, click When the computer starts or When I log on, and then click Next.

    • To select a schedule based on specific events, click When a specific event is logged, click Next; specify the event log and other information using the drop-down lists, and then click Next.

    • To schedule a program to start automatically, click Start a program, and then click Next.

  5. Click Browse to find the program you want to start, and then click Next.

  6. Click Finish.

  • 1
    Why are you blocking only www.? That's trivial to circumvent by going to m.facebook.com.
    – user1081
    Commented Feb 16, 2015 at 20:57
  • @nyuszika7h Good point. I'll edit my answer with some details.
    – Conor
    Commented Feb 16, 2015 at 21:06

I suggest using a configurable DNS service like OpenDNS. This is the "parental control" kind of service, but it fits your needs.

  • free for home use
  • Requires no fiddling with the hosts file, instead you once set the DNS servers at the router level.
  • Automatically works on all your local machines
  • Allows to configure allowed/disallowed categories as well as individual domain names.
  • As a plus, it also automatically disallowes recogniced malware sites, giving a some sort of improved security for your machines.

In case you want to work around that service on certain machines/accounts you manually override the DNS server entry for the network connection in use.


You can use Host Profiles to switch between different hosts files:

  • gratis
  • Windows /Linux (Mono, but only root user can launch the program.)

enter image description here

enter image description here

  • 1
    Totally off-topic: I' amazed how much better the same GUI looks on a different OS.
    – Marcel
    Commented Feb 16, 2015 at 9:52

You can use HostsMan to switch between different hosts files:

  • gratis
  • Windows

enter image description here

enter image description here

enter image description here

enter image description here

enter image description here


You can use Hosts Switcher to switch between different hosts files:

  • gratis
  • Windows
  • small tray icon

enter image description here


WinGate could help here. Since you're wanting to control several computers, either proxying or dealing with DNS could provide the answer.

WinGate has a DNS server built in, and you can use the WinGate policy system to divert DNS lookups to different locations based on time of day, or who made the request etc.

As a www proxy, you could do something similar based on forwarding the actual traffic through WinGate. There are 2 policy systems for web traffic in WinGate, a simplified rules-based system which will allow you to control who can go where and when, or a more powerful event/flow-chart based system which allows you to do pretty much anything.

WinGate has a free license for 3 concurrent users (we're increasing this soon to 10) and we also offer free support even to free license users.

Disclaimer: I work for Qbik, who are the authors of WinGate.

  • Thanks for your answer. Please make sure all your answers include the disclaimer. Commented May 27, 2016 at 6:32
  • cool, yes I went back and edited some for this.
    – Adrien
    Commented May 27, 2016 at 6:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.