cidr-calculator
Parse an IPv4 CIDR block (or an IP + dotted-decimal mask) and return network, broadcast, first/last usable host, total + usable IP counts, subnet/wildcard masks, the mask in binary, and the legacy IPv4 class.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| ip | No | Dotted-decimal IPv4 address, e.g. '192.168.1.10'. Used with `mask` when CIDR notation isn't provided. | |
| cidr | No | IPv4 CIDR notation, e.g. '192.168.1.0/24'. Provide this OR (ip + mask). Prefix length must be 0-32. | |
| mask | No | Dotted-decimal subnet mask, e.g. '255.255.255.0'. Must be a contiguous mask (all 1s then all 0s). Used with `ip` when CIDR notation isn't provided. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| cidr | Yes | Canonical CIDR notation, e.g. '192.168.1.0/24'. | |
| prefix | Yes | Prefix length, 0-32. | |
| ipClass | Yes | Legacy IPv4 class derived from the first octet (A/B/C/D/E). | |
| network | Yes | Network address (first IP in the block). | |
| hostBits | Yes | Number of host bits (32 - prefix). | |
| ipBinary | Yes | Input IP as 32 bits in dotted-octet binary. | |
| totalIps | Yes | Total IP addresses in the block (2^(32 - prefix)). | |
| broadcast | Yes | Broadcast address (last IP in the block); same as network for /32. | |
| usableIps | Yes | Usable host addresses (totalIps - 2, but 2 for /31 and 1 for /32). | |
| lastUsable | Yes | Last usable host address. Equals network for /31 and /32. | |
| maskBinary | Yes | Subnet mask as 32 bits split into 4 dotted octets, e.g. '11111111.11111111.11111111.00000000'. | |
| subnetMask | Yes | Subnet mask in dotted-decimal, e.g. '255.255.255.0'. | |
| firstUsable | Yes | First usable host address. Equals network for /31 and /32. | |
| wildcardMask | Yes | Wildcard mask in dotted-decimal (bitwise NOT of subnet mask). |