How it works
Enter any IPv4 address and a prefix length. The prefix says how many of the 32 bits identify the network; the rest identify hosts. The calculator masks the address down to the network (Subnet) base, derives the mask and broadcast, and counts the usable hosts. Written as CIDR (CIDR), 192.168.1.10 with prefix 24 is 192.168.1.10/24.
Formula
Broadcast = network OR the inverted mask.
Usable hosts = block size - 2 for blocks larger than 2.
Example
Example in plain words. 192.168.1.10 with prefix 24.
Network 192.168.1.0, mask 255.255.255.0.
Hosts run 192.168.1.1 to 192.168.1.254: 254 usable, with 192.168.1.255 as broadcast.
Frequently asked questions
Why subtract 2 from the host count?
The network address names the block itself and the broadcast address talks to everyone on it. Neither can be given to a device, so a /24 has 254 usable hosts, not 256.
What about /31 and /32?
A /32 is one address (a single host route); a /31 is a point-to-point link where both addresses are usable by convention. The calculator shows both addresses in those cases.