Download Article
A user-friendly guide to blocking access to a website using your PC, Mac, or Chromebook
Download Article

Do you want to prevent your kids (or yourself) from visiting a certain website on your computer? While installing a browser extension on Chrome, Edge, or Safari might seem like the answer, it'll only work to block sites for that browser. If you really need to make sure nobody can access a website from any web browser, we have you covered! This How.com.vn will show you how to completely block access to a website using your Chromebook, Mac, or Windows 10 or 11 computer.

Blocking Websites at a Glance=

On Google Chrome, Firefox, or Safari, download the Block Site extension. Enter a website, then create and set a password to block access to that site on your computer.

Method 1
Method 1 of 4:

Using Windows

Download Article
  1. How.com.vn English: Step 1 Open Start icon.
    Click the Windows logo in the bottom-left corner of the screen.
  2. How.com.vn English: Step 2 Type in notepad.
    This will search your computer for the Notepad app.
    Advertisement
  3. How.com.vn English: Step 3 Open Notepad in administrator mode.
    Right-click Notepad at the top of the Start window, click Run as administrator in the drop-down menu, and click Yes when prompted. The Notepad window will open.[1]
    • If your mouse doesn't have a right-click button, click the right side of the mouse, or use two fingers to click the mouse.
    • If your computer uses a trackpad instead of a mouse, use two fingers to tap the trackpad or press the bottom-right side of the trackpad.
  4. How.com.vn English: Step 4 Click File.
    It's in the top-left corner of the window. A drop-down menu will appear.
  5. How.com.vn English: Step 5 Click Open….
    This option is near the top of the File drop-down menu. Doing so opens a File Explorer window.
  6. Step 6 Navigate to the "etc" folder.
    To do so:
    • Click This PC on the left side of the File Explorer window.
    • Scroll down and double-click your hard drive's name (usually OS (C:)) in the middle of the window.
    • Double-click the "Windows" folder.
    • Scroll down and double-click the "System32" folder.
    • Scroll down and double-click the "drivers" folder.
    • Double-click the "etc" folder.
  7. Step 7 Click the "Text Documents (*.txt)" box.
    It's in the lower-right side of the window. A drop-down menu will appear.
  8. How.com.vn English: Step 8 Click All Files.
    This option is in the drop-down menu. You should see several files appear in the main window.
  9. Step 9 Remove security from the "hosts" file.
    Find the "hosts" file in the main Notepad window, then do the following:
    • Right-click the "hosts" file.
    • Click Properties in the drop-down menu.
    • Click the Security tab.
    • Click Edit.
    • Check the "Full Control" box.
    • Click OK, then click Yes when prompted.
    • Click OK.
  10. Step 10 Select the "hosts" file.
    Click the "hosts" file to do so.
  11. How.com.vn English: Step 11 Click Open.
    It's in the lower-right side of the window. The "hosts" file will open in Notepad.[2]
  12. How.com.vn English: Step 12 Create a new line at the bottom of the document.
    Click the very end of the last line on the page, then press Enter.
  13. How.com.vn English: Step 13 Add websites to the block list.
    To block a website in your computer's browsers, do the following:
    • Type in 127.0.0.1 and press Tab .
    • Type in a website's address without the "www" section (e.g., "facebook.com", "twitter.com").
    • Press Enter to start a new line, then repeat the above two steps with other addresses you want to block.
  14. How.com.vn English: Step 14 Block Google Chrome sites using this method.
    While you can block sites in most browsers using the above step, Google Chrome is slightly different: if you're blocking sites on Google Chrome, you'll need to place a space and then the "www.[site].com" version of the website's address after the "[site].com" version.[3]
    • To block Facebook, for example, you would type in 127.0.0.1facebook.com www.facebook.com.
    • Adding the "http://" or "https://" part of the address as well (e.g., 127.0.0.1facebook.com https://www.facebook.com can improve the chances of the site being blocked.
  15. How.com.vn English: Step 15 Try blocking alternative versions of the website's address.
    • IP address — You can find a website's IP address and then block it in the "hosts" file to prevent people from accessing the website via its IP address.
    • Mobile site — By placing "m." in front of a website's address (e.g., "m.facebook.com" instead of "facebook.com"), you can block the mobile version of the website as well.
  16. Step 16 Replace the existing "hosts" file with the edited one.
    To do so:
    • Click File in the top-left corner of Notepad.
    • Click Save As... in the drop-down menu.
    • Click the "Save as type" drop-down box, then click All Files in the drop-down menu.
    • Click the "hosts" file in the main window to select it.
    • Click Save, then click Yes when prompted.
  17. How.com.vn English: Step 17 Flush your computer's DNS cache.
    You'll use Command Prompt to perform this action. Flushing the DNS cache will prevent saved browser information from clashing with your blocked sites.[4]
    • Press the Windows key and type "cmd".
    • Right-click Command Prompt.
    • Click Run as administrator.
    • Click Yes to confirm.
    • In the Command Prompt, type ipconfig /flushdns.
    • Press Enter.
  18. How.com.vn English: Step 18 Restart all browsers.
    If you have any browser windows open, close them and then re-open them. Any websites you added to the "hosts" file should now be blocked in your browsers.
    • If the websites still aren't blocked after restarting your browsers, try restarting your computer.
  19. Advertisement
Method 2
Method 2 of 4:

On Mac

Download Article
  1. How.com.vn English: Step 1 Open Spotlight icon.
    Click the magnifying glass icon in the upper-right side of your Mac's screen. A text box will appear.
  2. How.com.vn English: Step 2 Type terminal into Spotlight.
    This will search your computer for the Terminal app.
  3. How.com.vn English: Step 3 Double-click icon Terminal.
    It should be the top option in the Spotlight search results. Doing so will open the Terminal app.
  4. Step 4 Open the "hosts" file.
    Type in sudo nano /etc/hosts and then press Return.
  5. How.com.vn English: Step 5 Enter your Mac's password.
    Type in the password that you use to log into your Mac, then press Return. The "hosts" file will open.
    • Terminal won't show your password's letters as you type.
  6. How.com.vn English: Step 6 Move the blinking cursor down to the bottom of the page.
    Press the key until the cursor is at the end of the last line of text on the page, then press Return.
  7. How.com.vn English: Step 7 Add websites to the block list.
    To block a website in your computer's browsers, do the following:
    • Type in 127.0.0.1 and press Tab .
    • Type in a website's address without the "www" section (e.g., "facebook.com").
    • Press Return to start a new line, then repeat the above two steps with other addresses you want to block.
  8. How.com.vn English: Step 8 Block Google Chrome sites using this method.
    While you can block sites in most browsers using the above step, Google Chrome is slightly different: if you're blocking sites on Google Chrome, you'll need to place a space and then the "www.[site].com" version of the website's address after the "[site].com" version.
    • To block Facebook, for example, you would type in 127.0.0.1facebook.com www.facebook.com.
    • Adding the "http://" or "https://" part of the address as well (e.g., 127.0.0.1facebook.com https://www.facebook.com can improve the chances of the site being blocked.
  9. How.com.vn English: Step 9 Try blocking alternative versions of the website's address.
    • IP address — You can find a website's IP address and then block it in the "hosts" file to prevent people from accessing the website via its IP address.
    • Mobile site — By placing "m." in front of a website's address (e.g., "m.facebook.com" instead of "facebook.com"), you can block the mobile version of the website as well.
  10. How.com.vn English: Step 10 Save and exit the editor.
    Once you have entered all of the sites that you want to block, save and exit by pressing Control+O and then pressing Return.
    • To exit the hosts file, press Control+X.
  11. How.com.vn English: Step 11 Flush your computer's DNS cache.
    Type in sudo killall -HUP mDNSResponder and press Return. This command will flush your Mac's DNS cache, which will ensure that all of the website's previous data (e.g., saved passwords) is erased. Your listed site should now be blocked in all browsers on your computer.
    • If your computer's browsers don't block the site, restart your computer to finalize the changes.
  12. Advertisement
Method 3
Method 3 of 4:

Using Chromebook & Google Chrome

Download Article
  1. How.com.vn English: Step 1 Open the Block...
    Open the Block Site page. This is the page from which you'll install Block Site.
    • Block Site allows you to block individual pages or entire websites. It also allows you to set a password so that other computer users can't change your block list.
  2. How.com.vn English: Step 2 Click ADD TO CHROME.
    It's a blue button in the upper-right side of the page.
  3. How.com.vn English: Step 3 Click Add extension when prompted.
    This option will appear at the top of the page. Clicking it prompts Block Site to install.
  4. How.com.vn English: Step 4 Click the Block Site icon.
    It's a shield-shaped option in the upper-right side of the Chrome page. A drop-down menu will appear.[5]
  5. How.com.vn English: Step 5 Click Edit block sites list.
    You'll find this in the drop-down menu. Doing so opens the Block Site page.
    • You can also click the gear-shaped icon in the top-right corner of the drop-down menu if you want to open the Block Site page.[6]
  6. How.com.vn English: Step 6 Enter a website's address.
    Click the "Enter a web address" text box near the top of the page, then type in the address of the website that you want to block.
    • If you want to block a specific page on a website, go to that page, then copy the address by clicking the address bar at the top of the window and then pressing Ctrl+C (Windows) or Command+C (Mac).
  7. How.com.vn English: Step 7 Click +.
    It's to the right of the website text field. Your website will immediately be added to Block Site's list of blocked websites.
    • You can remove your site from Block Site's blacklist at any time by clicking the red circle icon to the right of the website's URL in the list of blocked sites.
  8. How.com.vn English: Step 8 Click Password Protection.
    This tab is on the left side of the Block Site page.
  9. Step 9 Check the "Require a password to access Block Site menu" box.
    Doing so will create a password text box at the bottom of the page.
    • You can also check the "Enable password access to blocked pages" box if you want your password to allow you to open blocked sites.
  10. How.com.vn English: Step 10 Scroll down and enter a password.
    Type your preferred password (at least 5 characters) into the text box at the bottom of the page.
  11. How.com.vn English: Step 11 Click Set Password.
    It's to the right of the password text field. This will create your password and apply it to Block Site.
    • When accessing Block Site in the future, you'll need to enter your password before you can add or remove sites.
    • If you forget your password to Block Site, you can right-click the Block Site icon and click Remove from Chrome.
  12. How.com.vn English: Step 12 Allow Block Site in Incognito mode.
    One way that people can use to get around Block Site's restrictions is by using incognito mode, but you can enable Block Site in incognito to fix this problem:
    • Click
    • Select More tools
    • Click Extensions
    • Click DETAILS below the "Block Site" heading.
    • Click the grey "Allow in incognito" switch
      How.com.vn English: Android 7 Switch Off
      .
  13. Advertisement
Method 4
Method 4 of 4:

Using Firefox

Download Article
  1. How.com.vn English: Step 1 Open Firefox.
    Its app icon resembles an orange fox wrapped around a blue globe.
  2. How.com.vn English: Step 2 Open the Block...
    Open the Block Site webpage. This is the location from which you'll download Block Site.
  3. How.com.vn English: Step 3 Click + Add to Firefox.
    This blue button is in the middle side of the page. You may have to scroll down to see it.
  4. How.com.vn English: Step 4 Click Add when prompted.
    This is also at the top of the window. Doing so will install Block Site in your Firefox browser.
  5. How.com.vn English: Step 5 Click the Block Site app icon.
    It's an orange, shield-shaped icon in the upper-right side of the window. A drop-down menu will appear.[7]
    • You may have to click Got it in the drop-down menu before proceeding.
  6. How.com.vn English: Step 6 Click Edit block sites list.
    This is in the drop-down menu. Doing so opens the Block Site page.
    • You can also click the gear-shaped icon in the top-right corner of the drop-down menu to open the Block Site page.[8]
  7. How.com.vn English: Step 7 Enter a website's address.
    Click the "Enter a web address" text box near the top of the page, then type in the address of the website that you want to block.
    • If you want to block a specific page on a website, go to that page, then copy the address by clicking the address bar at the top of the window and then pressing Ctrl+C (Windows) or Command+C (Mac).
  8. How.com.vn English: Step 8 Click +.
    It's to the right of the website text field. Your website will immediately be added to Block Site's list of blocked websites.
    • You can remove your site from Block Site's blacklist at any time by clicking the red circle icon to the right of the website's URL in the list of blocked sites.
  9. How.com.vn English: Step 9 Click Password Protection.
    Go to the Block Site page. On the left side you will find the tab.
  10. Step 10 Make sure the box that says "Require a password to access Block Site menu" is selected.
    The password text box should appear at the bottom of the page.
    • Check the "Enable password access to blocked pages" box if you want your password to allow you to open block sites.
  11. How.com.vn English: Step 11 Scroll to the text box at the bottom of the page and enter a password with at least 5 characters.
  12. How.com.vn English: Step 12 Click the Set Password button.
    This will set your password and apply it to Block Site.
    • You'll need to enter your password before you can add or remove sites.
    • If you forget your password to Block Site, you can remove it from Firefox by clicking , clicking Add-ons, and clicking Remove to the right of "Block Site" on the Extensions page.
  13. Advertisement

Community Q&A

Search
Add New Question
  • Question
    How can I open a file on Windows 7 if I received an "Access is Denied" message?
    How.com.vn English: Community Answer
    Community Answer
    Find notepad.exe in your windows\system32 folder, and choose "Run as Administrator." Then, go to file, open and navigate to the hosts file, and remember to change the bottom file type from *.txt to All files.
  • Question
    Why did it say that I don't have permission to save?
    How.com.vn English: Community Answer
    Community Answer
    This may happen when a user might not be authorized to save or modify certain system files in Windows OS platform. To change this, locate the file that you wish to modify. Right-click on the file and select Properties. This opens a pop-up window with tools to tweak the file. Next, go to the Security tab and highlight the User/User name (aka User Account name) and its permission is displayed in the box below it. To allow permission, click on the Edit button and on the new pop-up window, highlight the User again and tick the items below to provide necessary permissions.
  • Question
    I tried saving, but it refuses to save. What should I do?
    How.com.vn English: Community Answer
    Community Answer
    Open Notepad as an administrator. Open Notepad >> in Notepad: click on file>>open file>>save.
See more answers
Ask a Question
200 characters left
Include your email address to get a message when this question is answered.
Submit
      Advertisement

      Video

      Tips

      • If your computer has a separate account for a child, you can use parental controls to monitor and restrict their browsing.

      Tips from our Readers

      • When editing the host file, it's better to put 0.0.0.0 instead of 127.0.0.1. That way, you don't have to deal with the localhost timeout, which can sometimes be a couple seconds. With 0.0.0.0, it will instantly tell you that a site can't load.
      Submit a Tip
      All tip submissions are carefully reviewed before being published
      Thanks for submitting a tip for review!
      Advertisement

      Warnings

      • Blocking websites with the "hosts" file is a good way to prevent any browsers from opening them, but people can still get around the block by using the mobile version of the website(s) in question.
      Advertisement

      About This Article

      How.com.vn English: Rain Kengly
      Written by:
      How.com.vn Technology Writer
      This article was co-authored by How.com.vn staff writer, Rain Kengly. Rain Kengly is a How.com.vn Technology Writer. As a storytelling enthusiast with a penchant for technology, they hope to create long-lasting connections with readers from all around the globe. Rain graduated from San Francisco State University with a BA in Cinema. This article has been viewed 1,528,608 times.
      How helpful is this?
      Co-authors: 34
      Updated: April 23, 2024
      Views: 1,528,608
      Categories: Internet Filtering
      Article SummaryX

      1. Run notepad as an administrator.
      2. Go to File > Open.
      3. Navigate to C:\Windows\System32\drivers\etc.
      4. Remove security from the "hosts" file.
      5. Open the "hosts" file.
      6. Type "127.0.0.1" at the bottom and press Tab.
      7. Type the address you want to block.
      8. Save the file.

      Did this summary help you?

      Thanks to all authors for creating a page that has been read 1,528,608 times.

      Is this article up to date?

      ⚠️ Disclaimer:

      Content from Wiki How English language website. Text is available under the Creative Commons Attribution-Share Alike License; additional terms may apply.
      Wiki How does not encourage the violation of any laws, and cannot be responsible for any violations of such laws, should you link to this domain, or use, reproduce, or republish the information contained herein.

      Notices:
      • - A few of these subjects are frequently censored by educational, governmental, corporate, parental and other filtering schemes.
      • - Some articles may contain names, images, artworks or descriptions of events that some cultures restrict access to
      • - Please note: Wiki How does not give you opinion about the law, or advice about medical. If you need specific advice (for example, medical, legal, financial or risk management), please seek a professional who is licensed or knowledgeable in that area.
      • - Readers should not judge the importance of topics based on their coverage on Wiki How, nor think a topic is important just because it is the subject of a Wiki article.

      Advertisement