You might need to do this if you are hurting your own productivity by visiting a website.
The simplest way to block access to a website from your computer is to edit your hosts file. The hosts file is a hold-over from the early days of the internet–before we had the DNS system. Anyway, navigate to
c:\windows\system32\etc on Windows, or /etc/ on Mac OS X, and edit the text file there called “hosts”.
Add a line at the bottom which is “127.0.0.1 www.sitetoblock.com”.
Save the file. When your browser tries to go to www.sitetoblock.com, it attempts to connect to your local machine (at IP address 127.0.0.1) to serve up the site. Because you don’t have the site on your local machine (aka your computer), nothing shows up. It’s as easy as that.