Cloudflare DNS to Block Malware: How It Works
Yes, Cloudflare’s public DNS resolver (1.1.1.1) can block malware when you enable its filtering feature, called Cloudflare Gateway or the “Malware” blocklist. You enter the special IP addresses (1.1.1.2 for malware blocking, 1.1.1.3 for malware plus adult content) in your router or device settings, and the resolver refuses to return IP addresses for domains known to host malware. This gives you a free, network-wide first line of defense against malicious websites without installing software on every device.
Background: What Cloudflare DNS Actually Does
Cloudflare’s public DNS service, launched in 2018, is one of the fastest resolvers in the world. Its standard addresses, 1.1.1.1 and 1.0.0.1, simply translate domain names into IP addresses—they do not filter anything. However, Cloudflare also operates a separate set of addresses for families and security-conscious users:
- 1.1.1.2 / 1.0.0.2 – blocks domains associated with malware, phishing, and botnet command-and-control servers.
- 1.1.1.3 / 1.0.0.3 – blocks malware and adult content, including sites that host pornography or sexual material.
These filtered addresses use the same underlying DNS infrastructure but consult a threat-intelligence feed that Cloudflare updates continuously. When a query arrives for a blocked domain, the resolver returns a synthetic “block page” IP address (0.0.0.0 or a special Cloudflare page) instead of the real server address, so the connection fails or redirects to a warning.
How to Set Up Cloudflare Malware Blocking
You have two main ways to use Cloudflare’s malware filter: at the router level (covers every device on your Wi-Fi) or per-device (covers only that phone, computer, or tablet). Both require changing the DNS server addresses your device uses.
- Router setup (recommended for whole-home coverage): Log into your router’s admin panel (usually at 192.168.1.1 or 192.168.0.1), find the “Internet” or “WAN” settings, and replace the DNS fields with
1.1.1.2and1.0.0.2. Save the settings and reboot the router. - Device setup (Windows/macOS/Android/iOS): Go to your network adapter’s DNS settings and enter the same addresses. On Windows, this is under Control Panel → Network and Sharing Center → Change adapter settings → IPv4 properties. On a phone, look in Wi-Fi settings → Modify network → IP settings → Static.
- Verify it works: Visit a known test domain like
cloudflare-dns.comor use an online DNS checker. To test blocking, try a domain from a public malware list (e.g.,malware.testcategory.comfrom the test sitetestcategory.com)—you should see a block page.
What It Blocks vs. What It Misses
Cloudflare’s malware filter is effective against domains that are clearly malicious—phishing sites, malware distribution servers, and known botnet command centers. However, it is not a full antivirus or endpoint protection. It cannot:
- Block malware that comes from a legitimate but compromised website (the domain itself is not on the blocklist).
- Stop malicious files already on your device.
- Prevent phishing via email links that point to newly created domains not yet in the threat feed.
- Filter content inside encrypted HTTPS traffic—it only sees the domain name, not the page content.
In practice, this means Cloudflare DNS is a strong supplement to antivirus software and safe browsing habits, not a replacement. It catches many known bad actors but has a detection lag of minutes to hours for brand-new threats.
Comparing Cloudflare DNS to Other Filtering Options
Cloudflare is not the only DNS-based malware filter. Here is how it stacks up against common alternatives:
- OpenDNS (Cisco Umbrella): Offers more granular filtering categories and per-user policies, but the free version only blocks phishing and malware. Cloudflare’s free tier is simpler and faster.
- Quad9 (9.9.9.9): Uses a blocklist from multiple threat-intelligence sources and is also free. Quad9 does not offer adult-content filtering, while Cloudflare does.
- AdGuard DNS: Blocks ads and trackers in addition to malware, but its free tier has fewer customization options than Cloudflare’s.
- NextDNS: Offers extensive customization (blocklists, allowlists, analytics) but requires an account and has a free quota; Cloudflare requires no account.
For most home users, Cloudflare’s malware-only filter is the easiest to set up because it requires no registration and works immediately. If you need to allow specific domains or see detailed logs, you would need a paid Cloudflare Gateway plan or a different service.
Common Problems and How to Fix Them
Users often run into a few issues when switching to Cloudflare’s filtered DNS:
- Some websites stop loading: If a site is falsely flagged (a “false positive”), you can temporarily switch back to 1.1.1.1 or use a different DNS. Cloudflare provides a form to report false positives, but it can take time to process.
- Router does not accept the addresses: Some ISP-provided routers lock DNS settings. In that case, set DNS on each device instead, or replace the router if you have administrative control.
- IPv6 users: Cloudflare also offers IPv6 addresses for filtering:
2606:4700:4700::1112(malware) and2606:4700:4700::1113(malware + adult). If your network uses IPv6, you must set both IPv4 and IPv6 DNS to avoid leaks. - DNS leaks: Some devices have “smart” DNS settings that ignore manual entries. On Windows, run
ipconfig /flushdnsafter changing settings. On Android, you may need to disable “Private DNS” or set it to “Automatic” for the manual DNS to take effect.
Cost, Privacy, and Safety Considerations
Cloudflare’s malware-blocking DNS is completely free for personal use. There is no account, no data cap, and no hidden premium tier for the basic filter. The company’s privacy policy states that it does not sell personal data and only keeps minimal logs (for security research) for 25 hours. However, note that using Cloudflare DNS means your DNS queries go to Cloudflare instead of your ISP, so Cloudflare sees which domains you visit. If you are concerned about that, you can use a VPN or a privacy-focused DNS like Quad9, which also logs minimally.
One safety caveat: DNS filtering is not a substitute for HTTPS. A malicious site with a valid SSL certificate will still load its content if the domain is not blocked. Always check for HTTPS and use a reputable antivirus program alongside DNS filtering.
Frequently Asked Questions
Does Cloudflare DNS block all malware?
No. It blocks domains known to host malware, phishing, or botnet activity, but it cannot stop malware that comes from a legitimate but compromised site, nor can it detect malicious files already on your device. It is a first-line filter, not a full security suite.
What is the difference between 1.1.1.2 and 1.1.1.3?
1.1.1.2 blocks malware only. 1.1.1.3 blocks malware plus adult content (pornography, sexual material, and some dating sites). Both are free and use the same speed and reliability as the standard 1.1.1.1 resolver.
Will Cloudflare DNS slow down my internet?
No. Cloudflare’s DNS is among the fastest in the world, and the filtering process adds negligible latency (usually under 1 millisecond). In many cases, it is faster than your ISP’s default DNS.
Can I use Cloudflare DNS on my phone?
Yes. On iOS, go to Settings → Wi-Fi → tap the “i” icon → Configure DNS → Manual and enter 1.1.1.2. On Android, go to Wi-Fi settings → Modify network → IP settings → Static and enter the same addresses. You can also use the free 1.1.1.1 app, but that app does not enable malware filtering by default—you must change the DNS addresses manually in the app’s settings.
How do I know if Cloudflare DNS is working?
After changing your DNS, visit a site like 1.1.1.1/help (Cloudflare’s connectivity check) or use an online DNS resolver test. To test blocking, try a known malicious domain from a public blocklist like malware.testcategory.com—you should see a block page instead of the site loading.
Can I whitelist a site that is blocked by mistake?
With the free version, no. You cannot add custom allowlists. If a site is falsely blocked, you can report it to Cloudflare’s false-positive form or temporarily switch your DNS back to 1.1.1.1. For permanent whitelisting, you would need a paid Cloudflare Gateway plan with custom policies.
Related
Method: the standard formula for this calculation, rounded as each result states. See how the calculators work or report an error.