How to block yourself from visiting a specific site

We all know it, we are working on something and we have to check up on some facts or do some research. This requires a browser and before you know it you have browsed youtube, a couple of news sites and way too many subreddits. This breaks your flow and makes you think: where did all my time for studying or working go? One tactic to combat this is to put it further out of reach, so it is not as easily accessible.

First I tried to figure out a standard way to block some sites in my browser - I would of course need to easily unblock them if needed. There were plugins but I sometimes use multiple browsers and I did not want a plugin.

What I ended up with was editing the hosts file. I simply pointed the domains I no longer wanted to visit to localhost (

Then when I wanted to access them again I simply commented them using #:


It might take a short while for this to work (there is probably some caching). You can find your hosts file here:

Windows: C:\Windows\System32\drivers\etc
Linux / iOS: /etc/hosts

I hope this helps someone out there keep their flow while working or studying!