IPv4 in CIDR
ipv4-in-cidr · version 1.0.0 · URLs & IP addresses · free, no key needed
Test whether a canonical IPv4 address lies in a CIDR prefix whose host bits are zero.
Use when you need to: ipv4 in cidr · check ipv4 cidr membership · ipv4 address in network prefix.
Supported
- ipv4 in cidr
- check ipv4 cidr membership
- ipv4 address in network prefix
Not supported
- IPv6
- IPv4-mapped IPv6
- ranges with hyphens
- dotted netmasks
- host bits ignored
Behavior
- address is a canonical dotted-decimal IPv4 address (four octets 0-255, no leading zeros, no spaces, no hex).
- cidr is dotted-decimal/prefix with prefix a JSON-decimal integer 0-32 and no leading zeros except 0.
- The CIDR network address must have host bits zero; otherwise the tool throws CIDR host bits must be zero.
- inside is true iff the address uint32 is in [network, network + 2^(32-prefix) - 1].
- Prefix 32 matches only the address itself. Prefix 0 is valid only as 0.0.0.0/0 and matches every IPv4 address.
- network is the canonical dotted network address; prefix is a JSON integer.
Input
address(string, required): max length 15; pattern^(?:0|[1-9][0-9]{0,2})(?:\.(?:0|[1-9][0-9]{0,2})){3}$cidr(string, required): max length 18
Output
inside(boolean, required)network(string, required): max length 15prefix(integer, required): min 0; max 32
Limits
- max address length: 15
- max cidr length: 18
- prefix min: 0
- prefix max: 32
Example
Request input:
{
"address": "192.168.1.10",
"cidr": "192.168.1.0/24"
}
Response:
{
"result": {
"inside": true,
"network": "192.168.1.0",
"prefix": 24
}
}
How to call it
MCP
Connect https://computefirst.net/mcp (setup), then call execute with:
{
"id": "ipv4-in-cidr",
"version": "1.0.0",
"input": {
"address": "192.168.1.10",
"cidr": "192.168.1.0/24"
}
}
HTTP (no key)
curl -X POST https://computefirst.net/v1/tools/ipv4-in-cidr/versions/1.0.0/execute \
-H "Content-Type: application/json" \
-d '{"address":"192.168.1.10","cidr":"192.168.1.0/24"}'
The machine-readable contract is at /v1/tools/ipv4-in-cidr/versions/1.0.0.
CLI
node cli.mjs run ipv4-in-cidr 1.0.0 --input input.json --base-url https://computefirst.net
Get the client at /clients/cli/.
Related tools
- IPv6 in CIDR: Test whether an IPv6 address lies in a CIDR prefix whose host bits are zero.
- IPv4 CIDR contains: Test whether one IPv4 CIDR block fully contains another IPv4 CIDR block.
- IPv4 CIDR overlap: Test whether two IPv4 CIDR blocks overlap (share at least one address).
- IPv4 CIDR parse: Parse an IPv4 CIDR block into its network, broadcast, netmask, wildcard mask, usable host range and address counts.
- IPv4 range to cidrs: Convert an arbitrary IPv4 address range into the minimal list of CIDR blocks that exactly covers it.
- IPv4 address classify: Classify an IPv4 address against the static IANA IPv4 special-purpose address registry.