How to Block a Website on Your Computer, Phone or Network
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.

In this article (8 sections)
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
| Where | Covers | Easy to bypass? |
|---|---|---|
| Hosts file (computer) | That computer, in all browsers | Yes, by someone with admin access or a VPN |
| Browser extension | That browser only | Yes, by another browser or removing it |
| Phone parental controls | That phone | Harder if protected with a passcode |
| Router DNS or parental controls | Every device on the Wi-Fi | Yes, 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.
- Open Notepad as administrator (right-click, Run as administrator).
- Open
C:\Windows\System32\drivers\etc\hosts(choose All files in the open dialog). - 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. - Save the file, then run
ipconfig /flushdnsin Command Prompt.
Mac
- Open Terminal and run
sudo nano /etc/hosts. Enter your password. - Add lines like
0.0.0.0 www.example.comat the end. - 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:
To keep your router settings from being changed, secure it as in how to secure your Wi-Fi network.



