📡

IP Subnet Calculator

Calculate subnet details from CIDR notation – network, broadcast, host range, and more

GET /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
Response 200 OK
{
  "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

Live Demo

Description

Calculate subnet details from CIDR notation – network, broadcast, host range, and more

How to Use

1

1. Pass a CIDR address in the `cidr` query parameter (e.g. `192.168.1.0/24` or `10.0.0.5/16`).

2

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

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

Frequently Asked Questions

Does it support IPv6?
Yes. Pass an IPv6 CIDR like `2001:db8::/32` and all fields are populated for the v6 network.
Why is `host_count` different from `total_addresses`?
`total_addresses` includes the network and broadcast addresses. `host_count` subtracts those two, giving the number of addresses actually assignable to hosts. For subnets with 2 or fewer addresses, they are equal.
Can I pass a host IP instead of a network address?
Yes. The API uses `strict=False`, so `192.168.1.50/24` is accepted and normalised to the `192.168.1.0/24` network.

Start using IP Subnet Calculator now

Get your free API key and make your first request in under a minute.