How to Block a Website on All Web Browsers

Today's WikiHow will show you how to prevent all browsers from accessing a specific website on your Windows or Mac computer by editing the 'hosts' file. Additionally, while it's not possible to block websites on the Android platform, you can still do so on your iPhone or iPad using the Restrictions menu in the Settings app.

On Windows

Open the Start menu. Click the Windows icon located in the lower left corner of the screen or press the key ⊞ Win.

On Windows 8, you must move the mouse pointer to the upper right corner of the screen and click the magnifying glass icon.

Tap NotepadStart. The Notepad application will appear at the top of the Start menu window.

Right-click Notepad and select Run as administrator . This option will open Notepad as administrator. If you don't open Notepad in administrator mode, you won't be able to edit the "hosts" file.

On laptops with touchpads that replace traditional mice, use two fingers to touch the touchpad instead of right-clicking.

Click Yes when asked to confirm your decision and open Notepad.

Click File and select Open .

Double-click the drive (C: ) then go to Windows > System32 > drivers > etc. Double-click each folder until you reach the "etc" folder.

Click the "Text Documents" drop-down menu and select All Files . You'll see a variety of file types appear in the window.

Double-click the "hosts" file. Notepad will open the "hosts" file and you can then view and edit the file content.

Scroll to the bottom of the "hosts" file. You will see two lines of "localhost" text here.

Click below the last line of text. This line can read "::1 localhost" or "127.0.0.1 localhost" and is at the bottom of the page. You must place the mouse pointer directly below the last line of text on this page.

Be careful not to delete any existing content in the hosts file.

Type 127.0.0.1then press Tab ↹. This is the computer's own loopback address. The computer responds with an error page in the web browser when someone tries to access the blocked site.

Type in the address of the website you want to block. For example, if you want to block Google, type www.google.com.

Press ↵ Enter. This will move the mouse pointer to a new line. The code you just entered tells your computer to redirect the web page to an alternate loopback address.

You can add as many websites as you want to block, one per line, using the same number sequence (127.0.0.1).

Click File then select Save . So all browsers on your computer will not be able to access the website you added to the hosts file.

To unblock a site, simply open the hosts file in Notepad as administrator again and delete the line containing the site you added. Make sure you save your changes after removing the lines you want, otherwise the website will still be blocked.

On Mac computers

Launch Spotlight .Click the magnifying glass icon located at the top right of the screen.

Type terminalin Spotlight. Terminal will appear at the top of the results list.

Double-click the Terminal icon.

Type the following code into Terminal:

sudo nano /etc/hosts

then press⏎ Return . The command will begin to be executed. The "hosts" file will be opened with a text editor, inside a Terminal window.

Type the computer password then press ⏎ Return. This is the password you use to log into your Mac computer.

Terminal will not display characters when you enter a password.

Move the blinking mouse pointer to the bottom of the page. To do this, press the key until the cursor is below the last line on the page.

Type: 127.0.0.1 . This is the computer's own loopback address. The computer will respond with an error page in the web browser when someone tries to access a blocked site.

Press Tab ↹. The mouse pointer will move to the right.

Don't press ⏎ Returnyet.

Enter the address of the website you want to block. For example, if you want to block Google, type www.google.com.

Press ⏎ Return. The computer will recognize and redirect the website to an alternate loopback address.

You can add as many websites as you want to block, one per line, using the same number sequence (127.0.0.1).

Press Control+X . This command is used to exit the hosts file in the text editor. You will be asked if you want to save the changes.

Click Yto save the changes. The computer will ask you what file name you want to save. We need to overwrite the original hosts file, so don't change the file name.

Press ⏎ Return. Changes will be saved to the hosts file. You will also exit the text editor and return to the Terminal window. So all browsers on your computer will not be able to access the website you added to the hosts file.

To unblock a page, simply open the hosts file in Notepad under admin again and delete the line containing the page you added. Make sure you save your changes after removing the lines you want, otherwise the website will still be blocked.

On iPhone and iPad

Open your iPhone's settings app. This is a gray application with a gear shape inside and is usually located on the Home screen.

Scroll down and tap General . This option is near the bottom of the iPhone screen, or at the top left of the iPad screen.

Scroll down and tap Restrictions near the middle of the General page.

Enter the passcode for your restrictions. This is the passcode you use to enable restrictions on your device.

If you haven't turned on restrictions, first tap Enable Restrictions and then enter your desired passcode twice.

Scroll down and tap Websites . This option is in the last section under the "ALLOWED CONTENT" heading.

Tap Limit Adult Content . You will see a blue check mark appear to the right of this option.

Click Add a Website , below the "NEVER ALLOW" heading. This option is last on the page.

Enter the address of the website you want to block. The address must start with "www" and end with a domain tag (such as ".com" or ".net"), it's okay to omit the "https://" part.

For example, if you want to block Facebook on your iPhone/iPad, you would type www.facebook.com.

Click the blue Done button in the lower right corner of the virtual keyboard. The page you selected will now be inaccessible in the Safari browser.

This setting also applies on other mobile browsers such as Chrome and Firefox.

5 ★ | 2 Vote