How the subnet calculator works
Enter an IPv4 address and a prefix length or subnet mask, or paste both together in CIDR form such as 192.168.1.10/24. The calculator shows the network and broadcast addresses, the range of usable host addresses, the number of hosts, the subnet and wildcard masks, the mask in binary and whether the address is in a private range.
IP addresses, masks and prefixes
An IPv4 address is 32 bits, written as four numbers from 0 to 255. A subnet mask marks how many of those bits identify the network; the rest identify devices (hosts) on it. The prefix length, the number after the slash, counts the network bits: /24 means the first 24 bits are the network, which is the mask 255.255.255.0.
Addresses in the subnet = 2^(32 − prefix)
Usable hosts = addresses − 2 (for /30 and larger networks)
Example: For 192.168.1.10/24, the network is 192.168.1.0 and the broadcast address is 192.168.1.255. That leaves 192.168.1.1 to 192.168.1.254 for devices: 254 usable hosts out of 256 addresses. The address 10.0.5.77 with mask 255.255.255.192 is in the /26 network 10.0.5.64, with hosts from 10.0.5.65 to 10.0.5.126.
Two addresses are not usable for hosts: the first identifies the network itself and the last is the broadcast address for messages to every device on it. A /31 is the exception, used for point-to-point links with both addresses usable, and a /32 is a single host.
Common subnet sizes
| Prefix | Subnet mask | Addresses | Usable hosts |
|---|---|---|---|
| /8 | 255.0.0.0 | 16,777,216 | 16,777,214 |
| /16 | 255.255.0.0 | 65,536 | 65,534 |
| /20 | 255.255.240.0 | 4,096 | 4,094 |
| /24 | 255.255.255.0 | 256 | 254 |
| /26 | 255.255.255.192 | 64 | 62 |
| /28 | 255.255.255.240 | 16 | 14 |
| /30 | 255.255.255.252 | 4 | 2 |
A wildcard mask is the subnet mask with every bit flipped, so /24 has the wildcard 0.0.0.255. It is used in router access lists and some routing protocols. The private ranges 10.0.0.0/8, 172.16.0.0/12 and 192.168.0.0/16 (RFC 1918) are reserved for home and company networks and are not routed on the public internet.