How it works
The IP address and CIDR prefix are converted to 32-bit numbers. Applying the subnet mask to the address gives the network address; flipping the mask and combining it with the network address gives the broadcast address. Everything in between is the usable host range.
Reading CIDR notation
A /24 means the first 24 bits identify the network, leaving 8 bits (256
addresses) for hosts. A smaller number after the slash means a bigger
network; a larger number means a smaller one — a /30 has only 4
addresses total.
Special cases at the edges
A /31 subnet has exactly 2 addresses and is commonly used for
point-to-point links where both addresses are usable. A /32 identifies a
single host, with no separate network or broadcast address at all.