IPv4 address compare
ipv4-address-compare · version 1.0.0 · URLs & IP addresses · free, no key needed
Compare two canonical IPv4 addresses by their numeric uint32 value.
Use when you need to: ipv4 address compare · compare ipv4 addresses · order ipv4 addresses.
Supported
- ipv4 address compare
- compare ipv4 addresses
- order ipv4 addresses
Not supported
- IPv6
- CIDR-aware comparison
Behavior
- address_a and address_b are canonical dotted-decimal IPv4 addresses.
- order is "less" if address_a < address_b numerically, "greater" if address_a > address_b, "equal" otherwise.
Input
address_a(string, required): max length 15; pattern^(?:0|[1-9][0-9]{0,2})(?:\.(?:0|[1-9][0-9]{0,2})){3}$address_b(string, required): max length 15; pattern^(?:0|[1-9][0-9]{0,2})(?:\.(?:0|[1-9][0-9]{0,2})){3}$
Output
order(one of "less", "equal", "greater", required)
Limits
- max address length: 15
Example
Request input:
{
"address_a": "10.0.0.1",
"address_b": "10.0.0.2"
}
Response:
{
"result": {
"order": "less"
}
}
How to call it
MCP
Connect https://computefirst.net/mcp (setup), then call execute with:
{
"id": "ipv4-address-compare",
"version": "1.0.0",
"input": {
"address_a": "10.0.0.1",
"address_b": "10.0.0.2"
}
}
HTTP (no key)
curl -X POST https://computefirst.net/v1/tools/ipv4-address-compare/versions/1.0.0/execute \
-H "Content-Type: application/json" \
-d '{"address_a":"10.0.0.1","address_b":"10.0.0.2"}'
The machine-readable contract is at /v1/tools/ipv4-address-compare/versions/1.0.0.
CLI
node cli.mjs run ipv4-address-compare 1.0.0 --input input.json --base-url https://computefirst.net
Get the client at /clients/cli/.
Related tools
- IPv6 address compare: Compare two IPv6 addresses by their numeric 128-bit value.
- IPv4 address distance: Compute the signed integer distance between two IPv4 addresses (address_b minus address_a).
- IPv4 address classify: Classify an IPv4 address against the static IANA IPv4 special-purpose address registry.
- IPv4 address offset: Add a signed integer offset to an IPv4 address, throwing if the result leaves the IPv4 address space.
- IPv4 in CIDR: Test whether a canonical IPv4 address lies in a CIDR prefix whose host bits are zero.
- IPv4 range to cidrs: Convert an arbitrary IPv4 address range into the minimal list of CIDR blocks that exactly covers it.