Snipget.ai

Is an IP in a CIDR network?

Exact
networking_ip_in_network

Deterministic and authoritative — the canonical answer for this input.

Test whether an IP is inside a CIDR network (e.g. is 10.0.0.5 in 10.0.0.0/24?). Returns contained and the normalized network. Processing multiple inputs? Use `networking_ip_in_network_batch` to do up to 1000 in one call.

Parameters

ipstringrequired

The IP address to test.

cidrstringrequired

The network in CIDR notation, e.g. 10.0.0.0/24.

Call it

curl -X POST https://api.snipget.ai/v1/networking/ip/in-network \
  -H "Authorization: Bearer sk_live_..." \
  -H "Content-Type: application/json" \
  -d '{"ip":"10.0.0.5","cidr":"10.0.0.0/24"}'

The Batch tab sends up to 1000 inputs in one call via /v1/networking/ip/in-network/batch.

Example response

{
  "input": [
    "10.0.0.5",
    "10.0.0.0/24"
  ],
  "is_valid": true,
  "contained": true,
  "network": "10.0.0.0/24"
}

FAQ

What does it answer?

Whether a single IP address falls inside a given network range written in CIDR notation, for example is 10.0.0.5 part of 10.0.0.0/24. The answer comes back as a simple true or false in the contained field.

Why use it instead of eyeballing it?

Deciding whether an address is inside a subnet involves bit-level math that is very easy to get wrong, which matters for allowlists and firewall rules. This computes containment exactly, so the yes/no is trustworthy.

How dependable is the result?

It is exact and deterministic. The containment test is computed from the address math, so the same IP and network always give the same answer.

What if the IP and network are different versions?

An IPv4 address is never inside an IPv6 network and vice versa, so it correctly returns contained false rather than an error.

What if I mistype the IP or the network?

If either the IP or the CIDR is invalid, it returns is_valid false with a reason and confidence 0, instead of throwing an error.

Related tools