Tools / Subnet calculator
IPv4 and IPv6 subnet calculator
Enter an address with a prefix length, or an IPv4 address with a dotted netmask. All arithmetic uses BigInt, so /0 and 128-bit IPv6 values are exact.
Examples:
Reading the result
The network address has every host bit set to 0. In IPv4 the broadcast address has every host bit set to 1, and the usable range lies between the two. The wildcard is the inverted mask, the form ACLs and some routing configurations expect. In the diagram the filled cells are the prefix (network bits) and the outlined cells are host bits. The digits are the bits of the address you entered.
Edge cases
A /32 is a single host. A /31 is a point-to-point link where both addresses are usable and there is no broadcast (RFC 3021). Older formulas that subtract 2 give 0 hosts there, which is wrong. /0 is the whole address space and appears only as a default route.
IPv6 has no broadcast. Every address in a prefix is assignable, though the all-zero host part is reserved for subnet-router anycast by convention. Subnets for hosts are /64 almost everywhere, because SLAAC requires it. A /127 is used for links between routers (RFC 6164).
Addresses are printed in the RFC 5952 form: lowercase, leading zeros removed, and the longest run of zero groups replaced by ::. IPv4-mapped addresses keep their dotted tail. Leading zeros in IPv4 input are refused because some tools read 010 as octal 8.