About the IP subnet calculator
An IPv4 address has 32 bits. The CIDR prefix says how many of the leading bits identify the network; the rest identify hosts. The subnet mask is those leading bits set to 1, the wildcard mask is its inverse, and the network address is the IP address with all host bits set to 0.
The broadcast address has all host bits set to 1. The usable range lies between the two. Two special cases follow RFC 3021: a /31 has two usable addresses for point-to-point links, and a /32 is a single host.
Formula
- Mask = first prefix bits set to 1
- Network = IP AND mask
- Broadcast = network OR (NOT mask)
- Usable hosts = 2^(32 − prefix) − 2 (/31 = 2, /32 = 1)
Example
For 192.168.1.130/26 the mask is 255.255.255.192, the network is 192.168.1.128, the broadcast is 192.168.1.191 and there are 62 usable hosts from 192.168.1.129 to 192.168.1.190.