A subnet cheat sheet maps each CIDR prefix length to its subnet mask and size. A /24 is 255.255.255.0 with 256 addresses (254 usable); each step down halves the block, so a /25 has 128 and a /26 has 64. Usable hosts are the total minus two, for the network and broadcast addresses.
How it works
Quick rules
- Addresses in a block = 2^(32 − prefix). A /26 has 2^6 = 64.
- Usable hosts = addresses − 2 (network and broadcast), except /31 (2 usable, for point-to-point links, RFC 3021) and /32 (a single host).
- Mask octet values are always one of 0, 128, 192, 224, 240, 248, 252, 254, 255.
- Block size in the interesting octet = 256 − mask value. Mask 255.255.255.224 → blocks of 32: .0, .32, .64…
- The wildcard mask (used in ACLs and OSPF) is the mask inverted: 255 − each octet.
Common home and office sizes
- /24 (255.255.255.0): the default home network, 254 devices.
- /23 or /22: larger offices, 510 or 1,022 hosts.
- /30 or /31: links between two routers.
- /16 (255.255.0.0): a whole private range like 172.16.0.0/16, usually split further.
IPv4 subnet chart
| Prefix | Subnet mask | Wildcard | Addresses | Usable hosts | Size vs /24 |
|---|---|---|---|---|---|
| /32 | 255.255.255.255 | 0.0.0.0 | 1 | 1 | 1/256 of a /24 |
| /31 | 255.255.255.254 | 0.0.0.1 | 2 | 2 | 1/128 of a /24 |
| /30 | 255.255.255.252 | 0.0.0.3 | 4 | 2 | 1/64 of a /24 |
| /29 | 255.255.255.248 | 0.0.0.7 | 8 | 6 | 1/32 of a /24 |
| /28 | 255.255.255.240 | 0.0.0.15 | 16 | 14 | 1/16 of a /24 |
| /27 | 255.255.255.224 | 0.0.0.31 | 32 | 30 | 1/8 of a /24 |
| /26 | 255.255.255.192 | 0.0.0.63 | 64 | 62 | 1/4 of a /24 |
| /25 | 255.255.255.128 | 0.0.0.127 | 128 | 126 | 1/2 of a /24 |
| /24 | 255.255.255.0 | 0.0.0.255 | 256 | 254 | 1 × /24 |
| /23 | 255.255.254.0 | 0.0.1.255 | 512 | 510 | 2 × /24 |
| /22 | 255.255.252.0 | 0.0.3.255 | 1,024 | 1,022 | 4 × /24 |
| /21 | 255.255.248.0 | 0.0.7.255 | 2,048 | 2,046 | 8 × /24 |
| /20 | 255.255.240.0 | 0.0.15.255 | 4,096 | 4,094 | 16 × /24 |
| /19 | 255.255.224.0 | 0.0.31.255 | 8,192 | 8,190 | 32 × /24 |
| /18 | 255.255.192.0 | 0.0.63.255 | 16,384 | 16,382 | 64 × /24 |
| /17 | 255.255.128.0 | 0.0.127.255 | 32,768 | 32,766 | 128 × /24 |
| /16 | 255.255.0.0 | 0.0.255.255 | 65,536 | 65,534 | 256 × /24 |
| /15 | 255.254.0.0 | 0.1.255.255 | 131,072 | 131,070 | 512 × /24 |
| /14 | 255.252.0.0 | 0.3.255.255 | 262,144 | 262,142 | 1,024 × /24 |
| /13 | 255.248.0.0 | 0.7.255.255 | 524,288 | 524,286 | 2,048 × /24 |
| /12 | 255.240.0.0 | 0.15.255.255 | 1,048,576 | 1,048,574 | 4,096 × /24 |
| /11 | 255.224.0.0 | 0.31.255.255 | 2,097,152 | 2,097,150 | 8,192 × /24 |
| /10 | 255.192.0.0 | 0.63.255.255 | 4,194,304 | 4,194,302 | 16,384 × /24 |
| /9 | 255.128.0.0 | 0.127.255.255 | 8,388,608 | 8,388,606 | 32,768 × /24 |
| /8 | 255.0.0.0 | 0.255.255.255 | 16,777,216 | 16,777,214 | 65,536 × /24 |
Examples
- 192.168.1.0/24: network 192.168.1.0, hosts .1–.254, broadcast 192.168.1.255.
- 10.0.0.64/26: block size 64, hosts 10.0.0.65–10.0.0.126, broadcast 10.0.0.127.
- Splitting a /24 into four: four /26s at .0, .64, .128 and .192, each with 62 usable hosts.
On a Mac
ifconfig en0 | grep 'inet ' shows your mask in hex: 0xffffff00 is 255.255.255.0, a /24. ipcalc (via Homebrew) and the subnet calculator below do the arithmetic for any network.
Try it
Try: , ,
- Network address
- 192.168.1.0
- Broadcast address
- 192.168.1.255
- Usable host range
- 192.168.1.1 – 192.168.1.254
- Usable hosts
- 254
- Total addresses
- 256
- Subnet mask
- 255.255.255.0
- Wildcard mask
- 0.0.0.255
- CIDR notation
- 192.168.1.0/24
- Binary mask
- 11111111.11111111.11111111.00000000
- IP class
- C
- Type
- Private (RFC 1918)
See it in the app
LightAtom's Map tells local-network connections apart from internet ones using your subnet.
Frequently asked questions
What is the subnet mask for /24?
255.255.255.0, giving 256 addresses and 254 usable hosts.
How many hosts are in a /27?
32 addresses, 30 usable hosts. Mask 255.255.255.224.
How do I calculate usable hosts?
2 to the power of (32 minus the prefix length), minus 2. For /28: 2^4 − 2 = 14.
What is a wildcard mask?
The inverse of the subnet mask, used by router ACLs and OSPF: /24's wildcard is 0.0.0.255.
Why does /31 have 2 usable hosts?
RFC 3021 allows /31s on point-to-point links, where no network or broadcast address is needed.