HomeNetworking › Subnet Calculator

Subnet Calculator & Visualizer

Enter an address and a prefix length. See the network, the broadcast, the usable range, and exactly which bits the mask is holding.

Local toolYour network plan stays in your browser. Nothing you enter is uploaded, logged, or sent to any server.

How the numbers are worked out

A prefix length says how many leading bits identify the network. The rest identify a host inside it. Everything else follows: the network address is the address with all host bits set to zero, the broadcast is the same with all host bits set to one, and the size of the subnet is two raised to the number of host bits.

Usable hosts are not always size minus two. That rule assumes a network address and a broadcast address which cannot be assigned. It holds from /0 to /30. It does not hold at /31, which RFC 3021 defines as a point-to-point link with two usable addresses and no broadcast, and it does not hold at /32, which is a single host route. Calculators that report zero usable addresses for a /31 disagree with the routers people actually configure.

IPv6 has no broadcast address at all, so every address in an IPv6 prefix is usable. Subtracting two there is simply an IPv4 habit applied where it does not belong.

A subnet mask must be a contiguous run of ones followed by zeros. Something like 255.255.0.255 is not a mask, and it is refused rather than quietly interpreted.

Related tools

VLSM Designer divides a network by host requirement. CIDR Range Calculator works the other way, from a prefix to its boundaries. IPv6 Visualizer handles compression and expansion.