CIDR / Subnet Calculator API

IPv4 / IPv6 subnet calculator: network, broadcast, netmask, host range and count; check if IPs are inside, split subnets, merge lists, range to CIDR.

GETPOSThttps://apibox.io.vn/v1/cidr
Network & Validation▶ Try it online

Give a network as cidr (192.168.1.0/24, 10.0.0.1/255.255.255.0, 2001:db8::/48) and get the network and broadcast address, netmask and wildcard mask, first / last address and usable host range, total addresses and usable hosts (RFC 3021 /31 and /32 handled), binary mask, class, address type (private, CGNAT, documentation, multicast…), the reverse DNS zone and the previous / next networks of the same size. IPv6 addresses are shown compressed and expanded, with the number of /64 subnets.

Other actions (chosen from the parameters, or with action): contains checks whether one or many ip (addresses or CIDRs) are inside the network; split cuts it into subnets by new prefix, number of subnets or hosts per subnet (up to 4096 listed); range turns first-last into the smallest list of CIDR blocks; merge takes a list of CIDRs, addresses and ranges (up to 10,000), merges overlapping and adjacent blocks into the minimal set and reports duplicates and overlaps.

Pure calculation with 128-bit integers: no lookup, nothing stored. For the owner and location of an address use /v1/ip, for cloud and Tor ranges /v1/ip-intel.

Parameters

NameInTypeRequiredDefault
cidrquery|bodystringnoNetwork (10.0.0.0/8, 10.1.2.3/255.0.0.0, 2001:db8::/32), a single address, or first-last for action=range. Also in the path: /v1/cidr/10.0.0.0%2F8.
actionquery|bodystringnoinfo, contains, split, range or merge (guessed from the other parameters when absent).
ipquery|bodystringnocontains: address(es) or CIDR(s) to test, comma or newline separated (up to 1000).
prefixquery|bodynumbernosplit: new prefix length.
subnetsquery|bodynumbernosplit: number of subnets wanted (rounded up to a power of two).
hostsquery|bodynumbernosplit: hosts needed per subnet.
limitquery|bodynumberno256split: subnets listed (1-4096).
listbody|queryarraynomerge: CIDRs, addresses and ranges a-b (array or separated by new lines, commas, spaces), up to 10,000.

Example

curl "https://apibox.io.vn/v1/cidr?cidr=192.168.10.0/26" \
  -H "Authorization: Bearer YOUR_API_KEY"

Response

{
  "action": "info",
  "cidr": "192.168.10.0/26",
  "version": 4,
  "prefix": 26,
  "network": "192.168.10.0",
  "netmask": "255.255.255.192",
  "wildcard": "0.0.0.63",
  "broadcast": "192.168.10.63",
  "first_address": "192.168.10.0",
  "last_address": "192.168.10.63",
  "first_host": "192.168.10.1",
  "last_host": "192.168.10.62",
  "total_addresses": 64,
  "usable_hosts": 62,
  "netmask_binary": "11111111.11111111.11111111.11000000",
  "network_hex": "0xc0a80a00",
  "integer_range": [
    3232238080,
    3232238143
  ],
  "class": "C",
  "type": "private",
  "reverse_zone": "10.168.192.in-addr.arpa",
  "previous_network": "192.168.9.192/26",
  "next_network": "192.168.10.64/26"
}

Use cases

  • Plan VPC subnets and VLANs (split a /16 into /24 blocks)
  • Clean and merge firewall or allowlist CIDR lists
  • Check whether client IPs fall inside an office or partner range
  • Convert IP ranges from logs or registries into CIDR notation

FAQ

How are /31 and /32 handled?

A /31 has two usable addresses (RFC 3021, point-to-point links) and no broadcast; a /32 is a single host.

What if the address has host bits set?

The network is computed from it (192.168.1.130/26 → 192.168.1.128/26) and the input address is shown with a note.

Is IPv6 supported everywhere?

Yes: info, contains, split, range and merge all work with IPv6, and lists can mix IPv4 and IPv6.

Related APIs

Start with 1,000 free requests every month. Get free API key →