Block a Website on Your Computer

Blocking websites, no matter the reason, is easier than most people think. Though it requires light coding, most of the work is simply copying and pasting, and all internet browsers allow you to block websites individually with ease. Be sure to fully understand the instructions before proceeding.

Note: You will need "Administrative" privileges to make the following changes. This means that you are the primary user of the computer, and have the passwords for its use.

Update:

  1. Since this tutorial is old, parts of it maybe old/non-usable on recent versions of Windows.For a latest up-to-date tutorial, visit here [1]

Steps

Blocking Websites on Windows

  1. Open My Computer and search your "C:" drive. To block any website, on every browser, you need to access and edit your "HOST" file. This file helps convert URL's, like www.google.com, to a numerical DNS address. However, you can use this conversion point to block your computer from ever accessing certain websites with a little modification.
    • If you don't see the folder "Windows" in C:, then look for it in another lettered drive. C is by far the most common drive for Windows, but it could be in any drive if you installed Windows yourself.[1]
  2. Find the "etc" folder in your drivers. To get there, click on Windows –>System32–>drivers–>etc. In the etc folder, look for the file "Hosts."
    • The final location you're heading for is C:\WINDOWS\system32\drivers\etc. You can type this into the top bar of My Computer if you're having trouble.
    • You can also find this by typing "notepad C:/Windows/System32/ drivers/etc/hosts" into a Command Prompt window. To use Command Prompt, find and open the program from the Start menu.[2]
  3. Open the file "hosts" with Notepad. Double-click on Hosts and choose Notepad when asked which program to use. This allows you to edit the file and block certain sites.
    • If you do not get the option to use Notepad, open the application separately. Then click "File" → "Open" in Notepad and find Hosts like you did before. Click on it to open the file.
  4. Scroll to the empty space at the bottom of the file. There will be a lot of code and text, but you don't have to touch any of it. Instead, scroll all the way down to the bottom, where the last line should be something resembling "127.0.0.1 localhost."
    • Do not edit or change anything as you're working. This file is essential to internet connections, and all you need to do add a few lines at the bottom to block websites.
  5. Hit enter to make a new line at the very bottom. Start your new line right underneath the last "localhost" line.
  6. Block websites by writing "127.0.0.1," followed by the website URL. At the beginning of the line, write 127.0.0.1, hit the space bar, then write out the URL of the website. For example, to block Google, you'd write "127.0.0.1 www.google.com."
    • Do not add the "http://" to the website URL, or it will fail to block.[3]
  7. Add additional websites on separate lines. If you want to block multiple sites, simply hit "enter" again to get on a new line. Add the 127.0.0.1 and then the website. There is no limit to the number of sites you can block.
  8. Save the file. Once you're done blocking sites, click on "File" → "Save." Close out any browsers you have open, then reopen them. Your sites should be blocked on all internet browsers.[1]

Blocking Websites on Mac

  1. Open Terminal. This is where you can make administrative changes to your Mac. Use the search bar to find it, or search in Finder under /Applications/Utilities/Terminal.[3]
    • Terminal is a black on white text window. It allows you to work with some of the code on your computer.
  2. Make a copy of your current hosts file in case you make a mistake. You will not be making large or difficult changes to the file, but it is best to have a backup anyway. To make one automatically, type “sudo /bin/cp /etc/hosts /etc/hosts-original” on the Command Line and hit "enter."
    • You may be prompted to type in your administrative password. This is the password used to get into the computer when it is started.
  3. Open your hosts file. Type “sudo nano /etc/hosts” and hit "enter" to open the "hosts" file in another window. This is the file that you actually need to adjust in order to block websites. Scroll down to the very bottom, past the final line (usually some form of the phrase "localhost."
  4. Start a new line with the phrase 127.0.0.1. This line tells your computer to block the site following it. Write out the number and then press the space bar.[1]
  5. Add the website you want blocked after the number. With one space, write out the URL of the website, starting with www. So, if you want to block Google, you'd write out "127.0.0.1 www.google.com". Make sure this is on its own line.
    • Do not add the "http://"
  6. Add any additional sites on their own lines. If you want more sites, hit enter, then add 127.0.0.1, a space, and the website. This will block the sites completely from your computer, on any browser.[4]
  7. Save the file. Press the Control Key + "O" (the letter, not "zero") to save the file, then close the window down. Your changes are almost in effect.
  8. Reset the cache to put your changes in effect. While still in Terminal, type in “sudo dscacheutil -flushcache” and press "enter." This will flush the cache, allowing your changes to take place. Open a browser to test if the change went through.
    • If it didn't, check out the Host file again, making sure your changes are at the end, on separate lines, and are properly formatted.
    • If this still doesn't work. Restart your computer, then try the sites again. They will be blocked.

Blocking Sites on Individual Browsers

Internet Explorer

  1. Open Internet Explorer. Internet Explorer (IE), Microsoft's browser of choice, makes it easy to block specific sites without a lot of extra work. However, these changes will not carry over to other browsers, like Firefox.
  2. Click Tools, then Internet Options, from the top menu. This will bring up a settings window that allows you to adjust the sites that are blocked. There are numerous tabs on top of the window that allow you to adjust your settings.
    • On newer versions of IE, this is represented by a gear icon, not "tools." Click on the gear, then select "Security Settings."
  3. Click the Privacy tab, then click on "sites." Type in the site address that you want to Block and Click OK. Remember this technique only blocks one site at a time.
    • On newer versions of IE, you must click "Restricted Sites," then "Sites."[2]
  4. Use your Microsoft account to block certain websites on the new IE, also known as Edge. In order to block sites on Microsoft's new version of Internet Explorer, which has been overhaul and renamed "Edge," you need a Microsoft account. With it, you can adjust your preferences online to block any sites you want from your account.

Mozilla Firefox or Google Chrome

  1. Open your web browser. Firefox and Chrome do not have a built-in way to block sites, but you can download a free plug-in that makes it easy to block certain sites from the browser.
    • In Chrome, you need the Chrome Web Store. For Firefox, these additions are called "Add-ons."
  2. Browse the selection of add-ons for your needs. Click on the three gray bars in the upper right corner of Firefox, then choose "Add-Ons" to browse the selection of parental controls and website blockers. For Chrome, click the "Apps" button in the upper left corner, then click on "Web Store."
  3. Find and download the right plug-in for you. Mozilla has a handy page illustrating all of the best blocking and parental control pages here. For simple blocking of websites on either site, your best bet is the simple but effective "BlockSite."
    • To find more robust programs, search for "parental controls or filters" in the web store or add-on library. These programs come with special controls that will block all types of web sites, such as a pornography filter.
    • Once downloaded, the plug-in will open up and ask you what sites you want to block.
    • If you cannot find the plug in, click on the three bars in the corner and click "Add-ons" (Firefox) or "Extensions" (Chrome).

Safari

  1. Open up Safari and click the Apple logo in the upper right corner. This brings up your options and preferences. Safari doesn't block websites, it lets you choose which ones to allow, making it much more restrictive.
  2. Select System Preferences and find the Parental Controls. This allows you to block sites and set yourself as the "parent account," letting you choose what other users can see on Safari.
  3. Click on "Convert this account to a parental controls account." This requires the administrative password -- the account used to log into the computer when it starts up. Once input, you will open up the Parental Controls window.
  4. Click on "Web" and then "Allow access to only these websites." This starts up the restrictions on Safari. You can add need pages using the "+" button and "Add Bookmarks."
    • To regain full control, simply uncheck "allow access to only these websites."



Tips

  • Parental control software, available online, can automatically block certain sites for you depending on the category, like games or pornography.

Related Articles

Sources and Citations