Skip to content
gohacks.dev
DevOps

IP in CIDR Range Checker

Check a list of IPv4 and IPv6 addresses against a list of CIDR ranges, such as a CDN's published ranges or a trusted proxy list, and see which range matched.

Free · No sign-up · Your inputs stay in your browser

Input

Check whether IPs fall inside CIDR ranges

Output

3 of 4 inside

IPInsideMatched range
172.20.4.9yes172.16.0.0/12
8.8.8.8no-
2606:4700:10::6816:1yes2606:4700::/32
173.245.63.255yes173.245.48.0/20

The same check a TrustProxies list, a security group or set_real_ip_from makes. Trusting too wide a range (0.0.0.0/0) lets any client forge X-Forwarded-For and appear to come from anywhere.

Runs in this browser. Nothing you paste is sent to a server.

Trusted proxies

Behind a load balancer or a CDN, the client IP arrives in X-Forwarded-For, which any client can also send. Frameworks only believe it from proxies you list: Laravel's trustProxies(at: [...]), Nginx's set_real_ip_from. Listing the provider's published ranges, rather than 0.0.0.0/0, is what stops a visitor from choosing their own IP.

Keeping lists current

CDNs publish their ranges and change them: Cloudflare at cloudflare.com/ips, AWS in ip-ranges.json. Fetch them on a schedule rather than pasting them once into a config file.

Share

Frequently asked questions

How do I check if an IP is in a subnet in PHP?
Symfony's IpUtils::checkIp($ip, $cidrs), which Laravel includes, handles IPv4 and IPv6 and a list of ranges.
Does 10.0.0.0/8 include 10.255.255.255?
Yes. A /8 covers every address whose first byte is 10.
Is what I paste sent anywhere?
No. The tool runs entirely in your browser with JavaScript. Nothing you type or paste is sent to our server or stored.

Keep planning

Similar tools