The address, mask, and CIDR prefix are converted to 32-bit integers and combined with bitwise AND/OR: the network address is the IP ANDed with the mask, the broadcast address ORs in the inverted mask, and usable hosts is the total address count minus 2 for the network and broadcast addresses — except at /31 and /32, which are handled as explicit special cases with 0 usable hosts rather than a negative number.
FAQ
Why do /31 and /32 both show 0 usable hosts?
The 'total minus 2' formula for network and broadcast addresses breaks down once a subnet has 2 or fewer addresses total, so both are shown as 0 rather than going negative — a /31 is actually valid for point-to-point links under RFC 3021, just without a distinct network/broadcast pair.
What happens if I type an invalid octet, like 256?
It's rejected immediately with an error message — every octet is checked to be an integer from 0 to 255 before any calculation runs.
Free, unlimited, no account. If this saved you a paid tool, a small thanks is appreciated.