How to Block Websites on a PC (Windows 10 and 11)

    Seven methods, from the hosts file to website blockers · Updated

    You can block websites on a Windows PC with the hosts file, a Google Chrome or Microsoft Edge policy, Microsoft Family Safety, a DNS filter, your router, a browser extension, or a website blocker. The fastest built-in method is the hosts file. Open C:\Windows\System32\drivers\etc\hosts in Notepad as administrator, add 0.0.0.0 example.com and 0.0.0.0 www.example.com on separate lines, save, and run ipconfig /flushdns. The site is then blocked in every browser on the PC.

    A teenager's bedroom at night, lit only by the glow of a Windows computer screen on the desk

    Key takeaways

    • The hosts file blocks specific websites in every browser on the PC, with no software to install.
    • Chrome and Edge each have a URLBlocklist policy that blocks sites without an extension, and can block every site except a few.
    • Family Safety parental controls filter websites in Edge for family members and block other browsers while they are on.
    • A DNS filter or your router covers every device on the network.
    • Built-in methods cannot block a site only during certain hours.
    • Every free method can be reversed by someone with administrator access.

    Methods compared

    A website blocker is the only method that is difficult to bypass.

    Seven ways to block websites on a Windows PC compared

    MethodEvery browserSchedules or time limitsCostDifficulty to bypass
    Hosts fileYesNoFreeEasy (edit the file)
    Browser policy (Chrome or Edge)One browser eachNoFreeEasy (delete the registry value)
    Microsoft Family SafetyEdge, other browsers blockedNoFreeOnly the family organiser can change it
    DNS filterYes, by categoryNoFreeEasy (change one setting)
    RouterEvery device on the networkSome routersFreeNeeds the router password
    Browser extensionOne browserSome extensionsFree or paidEasy (remove in one click)
    Website blockerYesYesFree or paidDifficult

    1. Edit the Windows hosts file

    The hosts file tells Windows which IP address belongs to a domain name. Pointing a site at 0.0.0.0 stops it from loading in every browser. The steps are the same on Windows 10 and 11.

    1. 1.Type Notepad in the Start menu search bar, right click it and select Run as administrator.
    2. 2.Select File, Open, go to C:\Windows\System32\drivers\etc, change the file type to All Files, and open hosts.
    3. 3.At the bottom, add both versions of each site on their own lines, for example 0.0.0.0 example.com and 0.0.0.0 www.example.com.
    4. 4.Save the file, then open Command Prompt and run ipconfig /flushdns to clear the DNS cache.

    Limits: it only blocks the exact domains you list, it cannot schedule, and anyone with administrator access can edit it back.

    2. Use the Google Chrome or Microsoft Edge URLBlocklist policy

    Chrome and Edge both read a URLBlocklist policy from the registry. This URL blocking stops listed sites from loading, with no extension.

    1. 1.Press Windows + R, type regedit and press Enter.
    2. 2.For Chrome, create HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Google\Chrome\URLBlocklist. For Edge, create HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Edge\URLBlocklist.
    3. 3.Inside it, create a String Value named 1 with a site such as example.com, then 2, 3 for more.
    4. 4.Restart the browser and check chrome://policy or edge://policy.

    Block every website except a few

    The same policy can block all websites and allow only the ones you choose.

    1. 1.In URLBlocklist, create a String Value named 1 with the value *. This blocks every site.
    2. 2.Next to URLBlocklist, create a key named URLAllowlist.
    3. 3.Inside it, add each site you want to keep as 1, 2, 3 and so on, for example wikipedia.org.
    4. 4.Restart the browser.

    Limits: each browser needs its own list, Microsoft states the Edge policy does not apply to a profile signed in with a Microsoft account, and an administrator can delete the values.

    3. Use parental controls: Microsoft Family Safety

    Family Safety filters inappropriate websites and lets the organiser block specific websites for members of a Microsoft family group. It works in Edge while the member is signed in to their Microsoft account, and blocks unsupported browsers while the filter is on.

    1. 1.Sign in at family.microsoft.com as the family organiser.
    2. 2.Select the family member, then Content filters.
    3. 3.Turn on Filter inappropriate websites and searches.
    4. 4.Add each site you want to block under Blocked sites.

    For a child who uses Chrome, Google Family Link does the same for a supervised Google account. On a computer, the child can switch to another Chrome profile where the settings do not apply.

    Limits: it needs a family group with an organiser, and it is built mainly for parents.

    4. Use DNS-level blocking

    A DNS filter blocks categories such as adult websites or malware for every browser on the PC. CleanBrowsing, OpenDNS FamilyShield and Cloudflare for Families are free.

    On Windows 11, set the addresses under Settings, Network & internet, Wi-Fi or Ethernet, Hardware properties, DNS server assignment. On Windows 10, open Control Panel, Network and Sharing Center, Change adapter settings, open your connection's Properties, and edit Internet Protocol Version 4.

    Limits: it blocks categories rather than sites you choose, and a VPN or a changed setting bypasses it.

    5. Block websites on your router

    Most routers have a website filter, often under Parental controls or Access restrictions, that blocks a site for every device on the network. You can also enter a DNS filter's addresses in the router's DNS settings.

    1. 1.Open your router's admin page, usually 192.168.1.1 or 192.168.0.1, and sign in.
    2. 2.Find the website filter or access restrictions section. The menu differs by brand.
    3. 3.Add the sites you want to block and save.

    Limits: anyone with the router password can remove the block, and a phone on mobile data is not covered.

    6. Use a browser extension

    Extensions such as BlockSite and LeechBlock NG block sites inside one browser and add schedules or time limits. Install them from the Chrome Web Store for Chrome and Edge, or from Firefox Add-ons for Mozilla Firefox, then add sites from the extension's icon in the browser toolbar.

    Turn on Allow in Incognito (Chrome), Allow in InPrivate (Edge) or Run in Private Windows (Firefox) in the extension's settings so it also works in private windows.

    Firefox has no built-in block list and does not read the Chrome or Edge policy, so an extension or the hosts file is the way to block websites in Firefox.

    Limits: one browser only, and removable in one click.

    7. Use a website blocker

    A website blocker applies the same blocks in every browser on the PC, with schedules, time limits and blocks that cannot be edited or removed until they end.

    Ascension is a website blocker built for this.

    Price: 15-day free trial, then $12.99/month or $50 one-time.

    1. 1.Install Ascension and add its extension to each browser it lists.
    2. 2.Block websites, URLs, search terms or keywords.
    3. 3.Choose how the block works: Always blocked, Scheduled block, Time limit or Entry delay.
    4. 4.Set the block so it cannot be edited or removed.

    Uninstall protection stops Ascension from being removed while a block runs.

    Limits: Windows only (iOS and Mac in development).

    Which method should you use?

    If you want to block a few sites in every browser for free, choose the hosts file. If you want to block every site except a few, choose the Chrome or Edge URLAllowlist policy. If you want to block sites for a child, choose Microsoft Family Safety. If you want to cover every device in your home, choose your router or a DNS filter. If you want blocks you cannot edit or remove if you lock them, choose a website blocker such as Ascension.

    Frequently asked questions

    Can I block websites on all browsers at once?

    Yes. The hosts file blocks a site in Chrome, Edge, Firefox and every other browser on the PC. A DNS filter or your router covers every browser on every device, and a website blocker such as Ascension applies the same blocks in each browser.

    Does blocking websites work in incognito mode?

    The hosts file, the browser policies, a DNS filter and router blocking apply in incognito automatically. A browser extension only works in private windows after you allow it in the extension's settings.

    How do I block all websites except one?

    Add * to the Chrome or Edge URLBlocklist policy to block every site, then add the site you want to keep to URLAllowlist. The steps are in method 2 above.

    Is blocking websites on Windows 10 different from Windows 11?

    The hosts file, the browser policies and extensions work the same way on both. Only the Settings menus for DNS differ.

    Can I schedule website blocking on Windows?

    Not with the hosts file, browser policies or Family Safety website filters. Some browser extensions and website blockers such as Ascension can block sites during set hours or after a daily time limit.

    Can Windows Firewall block a website?

    Windows Defender Firewall blocks traffic by IP address or program, not by domain name. Large websites use many IP addresses that change, so the hosts file or a browser policy is more reliable.

    Can a VPN bypass website blocking on Windows?

    A VPN can bypass a DNS filter and router blocking, because the VPN handles the lookups. The hosts file and browser policies still apply.

    How do I stop someone from bypassing website blocks?

    Combine methods, such as a DNS filter on the router and Family Safety on a child's account. To stop yourself from undoing a block, use a website blocker that can be set so its blocks cannot be edited or removed.

    What is the best way to block websites on a PC?

    A website blocker, because it is the hardest method to bypass. Every free method above can be undone by someone with administrator access.

    Try Ascension for free

    Available on Windows 10 & 11