CalcGallery

Computing

IPv4 subnets from CIDR notation: network and broadcast addresses, masks, wildcards and usable hosts, by the RFC rules.

Network arithmetic is binary arithmetic written in decimal, which is why it is easy to get wrong by hand. An IPv4 address is a 32-bit number shown as four octets, and a CIDR prefix such as /24 says how many of those bits name the network. Everything else follows from that one number: the mask is the prefix written as ones, the wildcard is its complement, the network address clears the host bits and the broadcast address sets them. Usable hosts are two fewer than the block size, because RFC 950 reserves the all-zeros and all-ones host values, except on a /31 point-to-point link, where RFC 3021 lets both addresses be hosts. The pages here show the mask in binary as well as decimal, and refuse input they cannot read unambiguously, such as an octet with a leading zero or a mask whose one-bits are not contiguous.