IP Subnet Calculator
Calculate subnet details from CIDR notation – network, broadcast, host range, and more
/v1/ip-calc
curl "https://dns.toolkitapi.io/v1/ip-calc?cidr=192.168.1.0/24"
import httpx
resp = httpx.get(
"https://dns.toolkitapi.io/v1/ip-calc?cidr=192.168.1.0/24",
)
print(resp.json())
const resp = await fetch("https://dns.toolkitapi.io/v1/ip-calc?cidr=192.168.1.0/24", {
});
const data = await resp.json();
console.log(data);
# See curl example
{
"network": "192.168.1.0/24",
"network_address": "192.168.1.0",
"broadcast_address": "192.168.1.255",
"netmask": "255.255.255.0",
"wildcard_mask": "0.0.0.255",
"prefix_length": 24,
"first_usable": "192.168.1.1",
"last_usable": "192.168.1.254",
"host_count": 254,
"total_addresses": 256,
"is_private": true,
"is_loopback": false,
"is_link_local": false,
"binary": "11000000101010000000000100000000",
"version": 4
}
Try It Live
Description
How to Use
1. Pass a CIDR address in the `cidr` query parameter (e.g. `192.168.1.0/24` or `10.0.0.5/16`).
2. The API normalises the input — a host address like `192.168.1.50/24` is accepted and treated as `192.168.1.0/24`.
3. Inspect `first_usable` and `last_usable` for the assignable host range, and `host_count` for the number of usable addresses.
About This Tool
IP Subnet Calculator takes a CIDR notation address (e.g. `192.168.1.0/24`) and returns everything you need to know about the subnet — network and broadcast addresses, netmask, wildcard mask, usable host range, total address count, and classification flags for private, loopback, and link-local ranges.
It supports both IPv4 and IPv6 addresses and includes the binary representation of the network address for bit-level analysis.
Why Use This Tool
- Network planning — Calculate subnet sizes and usable ranges for IP allocation
- Firewall rules — Verify CIDR blocks before adding them to ACLs or security groups
- Troubleshooting — Check if an IP falls within a given subnet's usable range
- Documentation — Generate subnet summaries for network diagrams and runbooks
Frequently Asked Questions
Does it support IPv6?
Why is `host_count` different from `total_addresses`?
Can I pass a host IP instead of a network address?
Start using IP Subnet Calculator now
Get your free API key and make your first request in under a minute.