PDF download Download Article
A user-friendly guide to blocking a website on PC, Mac, & Chromebook
PDF download Download Article

Do you want to prevent others (or yourself) from visiting a certain website on your computer? While installing a browser extension on Chrome, Edge, Firefox, or Safari might seem like the answer, it'll only block sites in that browser. If you really need to ensure no one can access a website in any web browser, we have you covered! This wikiHow guide will show you how to completely block access to a website on your Windows 10 or 11 computer, as well as on your MacBook or Mac desktop computer. We'll also show you how to block a website using the BlockSite browser extension on your Chromebook and in Firefox.

Blocking a Website on a Computer: At a Glance

To block a website in all web browsers on Windows and Mac, you'll need to add the website to your hosts file. On Windows, you can edit the hosts file (C:\Windows\System32\etc\hosts) as an administrator in Notepad. On a Mac, you'll need to use the Terminal app to edit the hosts file (/etc/hosts) with admin rights.

Method 1
Method 1 of 4:

Using Windows

PDF download Download Article
  1. This will search your computer for the Notepad app. Don't click the app just yet.
    Advertisement
  2. 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, press the right side of the mouse, or use two fingers to click.
    • 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.
  3. This option is near the top of the File drop-down menu. Doing so opens a File Explorer window.
  4. 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.
  5. Click the box that says Text Documents (*.txt) in the lower-right side of the window. A drop-down menu will appear.
  6. You should now see several files appear in the main window.
  7. This will allow you to make changes to the hosts file, which is where you can add a list of websites to block. To do so, follow these steps.
    • Right-click the "hosts" file.
    • Click Properties in the menu.
    • Click the Security tab.
    • Click Edit.
    • Check the "Full Control" box.
    • Click OK, then click Yes when prompted.
    • Click OK.
  8. The "hosts" file will open in Notepad.[2]
  9. Click the very end of the last line on the page, then press Enter.
  10. To block a website in all web browsers on your computer, do the following:
    • Type 127.0.0.1 and press Tab .
    • Type in a website's address without the "www" part (e.g., "facebook.com", "roblox.com").
    • Press Enter to start a new line.
    • If you want to block another website, type 127.0.0.1 again, press Tab }, and then enter the next address.
    • Repeat for all websites you want to block on this computer.
  11. If you find that certain websites are still accessible after you complete this method, you can also block websites using these options:
    • 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.
  12. 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 select All Files in the menu.
    • Click the "hosts" file in the main window to select it.
    • Click Save, then click Yes when prompted.
  13. You'll use Command Prompt to perform this action. Flushing the DNS cache will prevent saved browser information from clashing with your blocked sites.[3]
    • 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.
  14. 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.
  15. Advertisement
Method 2
Method 2 of 4:

On Mac

PDF download Download Article
  1. To block a website on your Mac, you'll need to make a change to the hosts file on your computer. The easiest way to do this is to use the Terminal app. To open Terminal, click the Launchpad (the multicolored squares) on your Dock, type terminal, and click Terminal.[4]
  2. Type in sudo nano /etc/hosts and then press Return.[5]
  3. Type in the password that you use to log into your Mac, then press Return. The "hosts" file will open for editing.
    • Terminal won't show your password's letters as you type.
  4. Press the key until the cursor is at the end of the last line of text on the page, then press Return.
  5. 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" part (e.g., "facebook.com").
    • Press Return to start a new line, then repeat the above two steps with other addresses you want to block.
  6. If completing this method doesn't block all parts of the website, you can replace the web addresses you enter with other options, including:
    • 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.
  7. Once you have entered all of the sites that you want to block, save and exit by pressing Control+O and then pressing Return.[6]
    • To exit the hosts file, press Control+X.
  8. Type in sudo killall -HUP mDNSResponder && echo macOS DNS Cache Reset 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.[7]
    • If your computer's browsers don't block the site, restart your computer to finalize the changes.
  9. Advertisement
Method 3
Method 3 of 4:

Using a Chromebook

PDF download Download Article
  1. Open the BlockSite page on the web store. To block a website on your Chromebook, you'll need to use a Chrome extension like BlockSite. BlockSite allows you to block individual pages or entire websites.
    • The basic option to block a website in BlockSite is free, but you'll need to pay for added features, such as the ability to password-protect the blocklist.
    • For a fully free alternative to BlockSite, try StayFocusd. Our guide to blocking a website with StayFocused will walk you through the process.
    • You can also use this method in the Chrome web browser on a PC or Mac, although it will only apply to Google Chrome. If you want to make sure the website is blocked in all browsers on the computer, jump to the steps for editing the hosts file on a PC or Mac.

>

  1. It's a blue button on the upper-right side of the page.
  2. This installs BlockSite on your Chromebook.
    • After installing BlockSite, you'll be prompted to accept the terms. You'll also be prompted to upgrade to a paid version. If you don't want to upgrade, click Skip to limited version when prompted.
    • BlockSite will prompt you to block certain websites at first. If you don't see the website you want to block in the list, just skip this prompt. You'll be able to block 3 websites in BlockSite in a few moments.
  3. It's a shield-shaped option in the upper-right side of the Chrome page. A drop-down menu will appear.[8]
    • If you don't see this icon, click the puzzle piece at the top-right corner of Chrome, then click the pushpin icon next to BlockSite to pin it to your toolbar.
  4. This opens BlockSite's settings panel, where you can add websites to your block list.[9]
    • You can also click the gear-shaped icon in the top-right corner of the drop-down menu if you want to open the BlockSite page.
  5. A field will open, allowing you to enter the URL of the website you want to block.[10]
  6. For example, if you want to block YouTube, enter youtube.com.
    • 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. Then, you can right-click the field and select Paste to paste it in.
  7. Advertisement

>

  1. It's to the right of the website text field. Your website will immediately be added to Block Site's list of blocked websites.[11]
    • You can add 2 more sites to your block list for free if you'd like.
    • When you're finished adding websites to your block list, click Done to continue.
    • You can remove your site from BlockSite's blocklist at any time by clicking the red circle next to the address.
  2. To prevent users from being able to edit the list of blocked websites, you can add a password to your block list. However, you'll need to upgrade to the full (paid) version of BlockSite to do so. If you'd like to proceed, click Password Protection in the left panel, and follow the on-screen instructions to subscribe.
  3. One way that people can use to get around BlockSite's restrictions is by using incognito mode, but you can enable BlockSite in incognito to fix this problem:
    • Click the menu at the top-right corner of the window.
    • Go to Extensions > Manage Extensions.
    • Click Details below the "BlockSite" heading.
    • Toggle on "Allow in incognito".
  4. Advertisement
Method 4
Method 4 of 4:

Using Firefox

PDF download Download Article
  1. Go to the BlockSite page on the Firefox Add-ons Store. If you only want to block websites in Firefox, you can use a free browser extension like BlockSite. Unlike in Chrome and other browsers, the full version of BlockSite for Firefox is totally free, including the ability to password-protect your block list and block up to 6 websites.
    • Keep in mind this extension will only block websites in Firefox and not other browsers on the computer. If you're trying to prevent your child from accessing a certain website, it's better to edit the hosts file on your PC or Mac.
  2. After a moment, a pop-up windows will appear.
  3. This is also at the top of the window. Doing so will install Block Site in your Firefox browser.
  4. This ensures you can easily access BlockSite when needed.
  5. It's a red shield-shaped icon on the toolbar.[12]
    • The first time you open the extension, you'll need to click Agree to agree to BlockSite's terms.
  6. This opens your BlockSite settings page.
  7. For example, if you want to block Roblox, you'd type roblox.com.[13]
    • 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. 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 blocklist at any time by clicking the red circle icon to the right of the website's URL in the list of blocked sites.
  9. To require a password to access your BlockSite settings, you can set up a password.
  10. For added protection, you can prevent others from editing your BlockSite settings and/or allow users to enter a password to access a blocked website.
    • If you want to be able to enter a password to access a blocked website, check the box next to "Require password to access blocked sites."
    • If you want to prevent users from making changes to your blocklist or settings, check the box next to "Protect your BlockSite Options and the Chrome Extension page with password." Even though it says "Chrome," this option will generally work to protect your block list. However, in our testing, we weren't able to make it prevent the extension from being uninstalled.
    • After choosing either option, enter your email address and create a password.
    • Then, open the email from BlockSite and click the Verify now button to confirm.
    • Now, you'll need to enter your password before you can add or remove sites.
  11. 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?
    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?
    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?
    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
Name
Please provide your name and last initial
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 using a VPN or mobile data on their phones.
Advertisement

You Might Also Like

Access Blocked WebsitesAccess Blocked Websites
Block a Website in All Web Browsers4 Ways to Block a Website in All Web Browsers
Block Proxy WebsitesBlock Proxy Websites
Block Facebook Block Facebook Website and App on Windows, Mac, and Mobile
Block a Website in Google Chrome Block a Site in Chrome: 4 Foolproof Ways
Block a Website in Safari3 Ways to Block a Website in Safari: iPhone, iPad, Mac
Block Yahoo!Block Yahoo!
Block Websites on Firefox6 Simple Ways to Block Websites on Mozilla Firefox
Edit the Hosts File on Windows Edit the Hosts File on Windows 10 & 11
Block YouTube4 Ways to Block YouTube on a Computer, Phone, or Tablet
Block and Unblock Internet Sites (On a Mac) Block and Unblock Websites on a Mac
Filter Porn Web Sites on Your Computer Block Porn on a Computer: 10 Ways on PC & Mac
Block Websites on an iPhoneBlock Websites on an iPhone
Get on Facebook When It's Blocked Get on Facebook When It's Blocked: 6 Ways
Advertisement

About This Article

Nicole Levine, MFA
Written by:
wikiHow Technology Writer
This article was co-authored by wikiHow staff writer, Nicole Levine, MFA. Nicole Levine is a Technology Writer and Editor for wikiHow. She has more than 20 years of experience creating technical documentation and leading support teams at major web hosting and software companies. Nicole also holds an MFA in Creative Writing from Portland State University and teaches composition, fiction-writing, and zine-making at various institutions. This article has been viewed 1,843,098 times.
How helpful is this?
Co-authors: 34
Updated: August 19, 2026
Views: 1,843,098
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,843,098 times.

Is this article up to date?

Advertisement