How the Subnet Calculator Derives Each Field
For IPv4 the address and prefix are parsed to a 32-bit integer and a mask (a run of 1s for the network bits). ANDing the address with the mask zeroes the host bits to give the network address; ORing with the wildcard (inverted mask) sets them to give the broadcast address. The usable range is network + 1 to broadcast − 1, and usable hosts is 2^(32−prefix) − 2, with /31 and /32 special-cased per RFC 3021. The dotted mask, wildcard mask, CIDR, IP class and RFC type are derived from the same integers. IPv6 is computed with 128-bit BigInt, deriving the network prefix, first and last address, and the exact 2^(128−prefix) total.
- IPv4 network = address AND mask; broadcast = address OR wildcard
- Usable hosts = 2^(32−prefix) − 2, except /31 (2) and /32 (1)
- Wildcard mask is the bitwise inverse of the subnet mask
- IPv6 uses 128-bit BigInt for exact network, range and totals
- RFC type covers private, loopback, CGNAT, documentation, multicast
