IPv4 prefix for hosts

ipv4-prefix-for-hosts · version 1.0.0 · URLs & IP addresses · free, no key needed

Compute the smallest IPv4 CIDR block (largest prefix length) whose usable host capacity meets a required count.

Use when you need to: ipv4 prefix for hosts · subnet size for host count · minimal ipv4 prefix for hosts.

Supported

Not supported

Behavior

Input

Output

Limits

Example

Request input:

{
  "usable_hosts": 60
}

Response:

{
  "result": {
    "prefix": 26,
    "netmask": "255.255.255.192",
    "usable_host_count": "62",
    "total_count": "64"
  }
}

How to call it

MCP

Connect https://computefirst.net/mcp (setup), then call execute with:

{
  "id": "ipv4-prefix-for-hosts",
  "version": "1.0.0",
  "input": {
    "usable_hosts": 60
  }
}

HTTP (no key)

curl -X POST https://computefirst.net/v1/tools/ipv4-prefix-for-hosts/versions/1.0.0/execute \
  -H "Content-Type: application/json" \
  -d '{"usable_hosts":60}'

The machine-readable contract is at /v1/tools/ipv4-prefix-for-hosts/versions/1.0.0.

CLI

node cli.mjs run ipv4-prefix-for-hosts 1.0.0 --input input.json --base-url https://computefirst.net

Get the client at /clients/cli/.