Whether you are managing a school, business, or home network, this guide shows you how to block Facebook completely using DNS filtering, hosts file rules, and firewall configurations.
Learn About PricingThe easiest way to block Facebook on your network is to use CleanBrowsing's paid filtering service. In the CleanBrowsing dashboard, simply toggle the Social Media category to blocked. This automatically blocks facebook.com and all associated CDN, API, and tracking domains.
When a user on your network tries to access Facebook after it has been blocked, they will see a DNS_PROBE_FINISHED_NXDOMAIN error in their browser. This means the DNS resolver returned no result for the domain, effectively making it unreachable.
To get started, configure your network to use CleanBrowsing DNS and enable the Social Media category in your dashboard. See our paid account configuration guide.
If you prefer a manual approach or need to block Facebook on a single device, you can map Facebook domains to 0.0.0.0 in your hosts file. This sends all Facebook requests to a null address, effectively blocking access.
Add these entries to block the primary Facebook domains:
Meta (formerly Facebook) also owns Instagram. To block the full Meta ecosystem, add:
Note: For complete coverage, the full list of Facebook-related domains can include 800+ entries covering CDN subdomains, regional domains, API endpoints, and tracking pixels. See our full list: Complete Facebook Domain List.
After configuring your block, verify that it is working correctly and plan for ongoing maintenance.
Use nslookup or dig to confirm that Facebook domains are being blocked:
If the block is working via CleanBrowsing, you should see an NXDOMAIN response or a response pointing to a block page IP. If using hosts file blocking, the lookup will return 0.0.0.0.
The Facebook mobile app may use cached DNS responses or hardcoded IPs in some cases. If the app was recently used before the block was applied, it may continue working temporarily until the cache expires. Steps to address this:
ipconfig /flushdns on Windows or sudo dscacheutil -flushcache on Mac.For the most thorough blocking, combine DNS filtering with firewall rules that block Facebook's IP ranges. Facebook's primary AS number is AS32934. You can look up their published IP ranges and block them at the firewall level.
This is particularly important for apps that may bypass DNS or use encrypted DNS (DoH/DoT) to resolve Facebook domains outside your filtered DNS. Blocking the IP ranges at the firewall ensures Facebook is unreachable regardless of how DNS is handled.