Calculate network address, broadcast address, host range and subnet mask for any IPv4 address.
An IPv4 address combined with a prefix length defines a subnet. The network address is found by ANDing the IP with the subnet mask, the broadcast address by ORing the network address with the inverted mask. Usable host addresses fall between these two endpoints, excluding the network and broadcast addresses themselves.
Network address
network = IP AND mask
Usable hosts
hosts = 2^(32 - prefix) - 2
The CIDR prefix length (e.g. /24) specifies how many leading bits of the 32-bit address are the network portion. A /24 means the first 24 bits identify the network and the remaining 8 bits identify hosts within it, giving 254 usable host addresses.
The first address in the range is the network address (used to identify the subnet itself) and the last is the broadcast address (used to reach all hosts on the subnet simultaneously) — neither can be assigned to a host device.