Skip to content
SpeedTestGO

How to Block a Website on Your Computer, Phone or Network

Shawn Stolting

2 min read

Published Updated

Short answer

Block a site on one computer with the hosts file, on iPhone with Screen Time, or on the whole network with router controls or filtering DNS. Any block can be bypassed with a VPN.

Block Any Website On Your Computer, Phone, or Network
In this article (8 sections)
  1. Choose where to block
  2. Windows
  3. Mac
  4. iPhone and iPad
  5. Android
  6. The whole network
  7. Limits
  8. FAQs

You can block a website on one device by editing its hosts file, or on every device at once by changing the router's DNS or parental controls. Device-level blocks are easy but only cover that device. Router-level blocks cover the whole network, but a determined person can get around any of them with a VPN or mobile data.

Choose where to block

WhereCoversEasy to bypass?
Hosts file (computer)That computer, in all browsersYes, by someone with admin access or a VPN
Browser extensionThat browser onlyYes, by another browser or removing it
Phone parental controlsThat phoneHarder if protected with a passcode
Router DNS or parental controlsEvery device on the Wi-FiYes, on mobile data or with a VPN

Windows

The DNS system, which converts names such as www.example.com into IP addresses, first checks a local file called hosts. Adding a line there redirects the name to your own computer, so it fails to load.

  1. Open Notepad as administrator (right-click, Run as administrator).
  2. Open C:\Windows\System32\drivers\etc\hosts (choose All files in the open dialog).
  3. At the end, add a line such as 0.0.0.0 www.example.com, one site per line. Add the version without www too.
  4. Save the file, then run ipconfig /flushdns in Command Prompt.

Mac

  1. Open Terminal and run sudo nano /etc/hosts. Enter your password.
  2. Add lines like 0.0.0.0 www.example.com at the end.
  3. Save with Control+O, exit with Control+X, then run sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder.

iPhone and iPad

Use Screen Time: Settings, Screen Time, Content & Privacy Restrictions, Content Restrictions, Web Content. Choose Limit Adult Websites and add specific sites under Never Allow, or choose Only Approved Websites. Protect Screen Time with a passcode only you know.

Android

Use Google Family Link for a child's account, or a trusted parental-control app. Editing the hosts file on Android needs a rooted phone, which we do not recommend. In Chrome you can also set a filtering DNS under Settings, Network, Private DNS.

The whole network

  • Router parental controls. Many routers can block sites or categories by schedule and device.
  • Filtering DNS. Set the router's DNS to a filtering service. Cloudflare for Families (1.1.1.2 for malware, 1.1.1.3 for malware and adult content) and OpenDNS FamilyShield are free examples.

Limits

  • A hosts-file block works only for that exact name. A site with several addresses may need several lines.
  • VPNs, proxies and mobile data get around most blocks.
  • A filter that adds a DNS lookup can change loading time slightly. You can check with a speed test afterwards:

Internet Speed Tester

Press Start. After the test you get a network quality score and what your speed is good for.

Download

0.0 Mbps

Upload

0.0 Mbps

Ping

0.0 ms

Jitter

0.0 ms

Your last results

How this test measures

The test runs against the nearest Cloudflare data center, shown above as the server. Results describe the path between you and that server, which can differ from the path to a particular website, game or call server.

Ping is the median round-trip time of 60 small requests, and jitter is the average difference between consecutive ones. Download and upload use files of growing size sent one after another over a single connection, and the result is the 90th percentile of the requests that ran long enough to be reliable. Speeds are in megabits per second (1 Mbps = 1,000,000 bits).

Because it uses one connection, the test can read lower than a multi-connection test on very fast or distant links. Wi-Fi, a VPN, other devices and a busy browser can all lower the result, so use a cable and close other apps for the most accurate number. Nothing from the test is stored on our servers.

Powered by Cloudflare's network. No account needed.

To keep your router settings from being changed, secure it as in how to secure your Wi-Fi network.

FAQs

What is the easiest way to block a website?
On one computer, edit the hosts file or use Screen Time on an iPhone. For all devices at home, use the router's parental controls or a filtering DNS.
Can a hosts file block be bypassed?
Yes. Someone with admin rights can edit it, and a VPN or different DNS settings can avoid it. It is best for simple blocking.
How do I block a website on my whole Wi-Fi network?
Use your router's website blocking or parental controls, or set the router's DNS to a filtering service.
Will blocking a website work on mobile data?
Not for network-level blocks. A router block only applies while the device uses your Wi-Fi.
Do I need to restart after editing the hosts file?
Usually you only need to flush the DNS cache or restart the browser, but a restart always works.
Read nextDrawbacks of Using Proxy Servers: Speed, Security and BlocksTry itInternet Speed TestDownload, upload, ping and jitter in about half a minute.