Subnet Calculator
Calculate network, broadcast, usable host range, subnet mask, and wildcard mask for IPv4 CIDR.
Show binary view
Subnetting basics (IPv4)
Subnetting splits a larger IP network into smaller segments (subnets) so you can organize hosts,
contain broadcasts, and apply routing or security policies per segment. In CIDR notation
(e.g., 192.168.1.10/24), the prefix length (/24) tells you how many of the first
bits are the network portion. The rest are for host addresses inside that subnet.
- Subnet mask: dotted-decimal form of the prefix (e.g.,
/24→255.255.255.0). - Wildcard mask: the inverse of the subnet mask (often used in ACLs). Example:
255.255.255.0→0.0.0.255. - Network address: all host bits set to 0 (the first address of the subnet).
- Broadcast address: all host bits set to 1 (the last address of the subnet).
- Usable host range: addresses between network and broadcast (classic IPv4). For
/31and/32, see notes below.
How this calculator works
Given IP and /prefix:
mask = firstbits set to 1 (32-bit) wildcard = bitwise NOT of mask network = IP AND mask broadcast = network OR wildcard total hosts = 2^(32 - prefix) usable = (prefix <= 30) ? (total - 2) : 0 host range = (prefix <= 30) ? [network+1 ... broadcast-1] : N/A
Note on /31 and /32: in “classic” accounting, there are no usable hosts because network/broadcast take
the edges. In practice, /31 is commonly used on point-to-point links (RFC 3021) where both addresses are assigned
and no broadcast exists; /32 represents a single host route.
Quick examples
Example 1: 192.168.1.10/24
- Mask:
255.255.255.0· Wildcard:0.0.0.255 - Network:
192.168.1.0· Broadcast:192.168.1.255 - Usable range:
192.168.1.1 – 192.168.1.254(254 hosts)
Example 2: 10.12.34.56/20
- Mask:
255.255.240.0· Wildcard:0.0.15.255 - Network:
10.12.16.0· Broadcast:10.12.31.255 - Usable range:
10.12.16.1 – 10.12.31.254(4094 hosts)
Private IPv4 ranges (for LANs)
10.0.0.0/8(10.0.0.0 – 10.255.255.255)172.16.0.0/12(172.16.0.0 – 172.31.255.255)192.168.0.0/16(192.168.0.0 – 192.168.255.255)
FYI: 169.254.0.0/16 is link-local (APIPA)—assigned automatically when DHCP fails; not routed.
Common CIDR cheat sheet
| Prefix | Subnet mask | Total | Usable* |
|---|---|---|---|
| /32 | 255.255.255.255 | 1 | 0 |
| /31 | 255.255.255.254 | 2 | 0† |
| /30 | 255.255.255.252 | 4 | 2 |
| /29 | 255.255.255.248 | 8 | 6 |
| /28 | 255.255.255.240 | 16 | 14 |
| /27 | 255.255.255.224 | 32 | 30 |
| /26 | 255.255.255.192 | 64 | 62 |
| /25 | 255.255.255.128 | 128 | 126 |
| /24 | 255.255.255.0 | 256 | 254 |
| /23 | 255.255.254.0 | 512 | 510 |
| /22 | 255.255.252.0 | 1,024 | 1,022 |
| /21 | 255.255.248.0 | 2,048 | 2,046 |
| /20 | 255.255.240.0 | 4,096 | 4,094 |
| /19 | 255.255.224.0 | 8,192 | 8,190 |
| /18 | 255.255.192.0 | 16,384 | 16,382 |
| /17 | 255.255.128.0 | 32,768 | 32,766 |
| /16 | 255.255.0.0 | 65,536 | 65,534 |
| /12 | 255.240.0.0 | 1,048,576 | 1,048,574 |
| /8 | 255.0.0.0 | 16,777,216 | 16,777,214 |
*Usable excludes network & broadcast in classic IPv4 subnets.
†Many devices allow /31 on point-to-point links; both addresses are assignable.