Subnet cheat sheet
Every IPv4 prefix, its masks, its size and its usable hosts. Bookmark it and stop deriving this.
Print or keep it
Download the PDF ↓One page, US Letter, laid out to be pinned above a desk. It carries the same tables as this page and is generated from the same data, so the two cannot disagree.
Every prefix from /8 to /32
Usable host counts already have the network and broadcast addresses subtracted. The two exceptions are called out in the notes.
| CIDR | Subnet mask | Wildcard | Addresses | Usable | |
|---|---|---|---|---|---|
/8 | 255.0.0.0 | 0.255.255.255 | 16,777,216 | 16,777,214 | 10.0.0.0/8 |
/9 | 255.128.0.0 | 0.127.255.255 | 8,388,608 | 8,388,606 | |
/10 | 255.192.0.0 | 0.63.255.255 | 4,194,304 | 4,194,302 | |
/11 | 255.224.0.0 | 0.31.255.255 | 2,097,152 | 2,097,150 | |
/12 | 255.240.0.0 | 0.15.255.255 | 1,048,576 | 1,048,574 | 172.16.0.0/12 |
/13 | 255.248.0.0 | 0.7.255.255 | 524,288 | 524,286 | |
/14 | 255.252.0.0 | 0.3.255.255 | 262,144 | 262,142 | |
/15 | 255.254.0.0 | 0.1.255.255 | 131,072 | 131,070 | |
/16 | 255.255.0.0 | 0.0.255.255 | 65,536 | 65,534 | 192.168.0.0/16 |
/17 | 255.255.128.0 | 0.0.127.255 | 32,768 | 32,766 | |
/18 | 255.255.192.0 | 0.0.63.255 | 16,384 | 16,382 | |
/19 | 255.255.224.0 | 0.0.31.255 | 8,192 | 8,190 | |
/20 | 255.255.240.0 | 0.0.15.255 | 4,096 | 4,094 | |
/21 | 255.255.248.0 | 0.0.7.255 | 2,048 | 2,046 | |
/22 | 255.255.252.0 | 0.0.3.255 | 1,024 | 1,022 | |
/23 | 255.255.254.0 | 0.0.1.255 | 512 | 510 | |
/24 | 255.255.255.0 | 0.0.0.255 | 256 | 254 | the default home network |
/25 | 255.255.255.128 | 0.0.0.127 | 128 | 126 | |
/26 | 255.255.255.192 | 0.0.0.63 | 64 | 62 | |
/27 | 255.255.255.224 | 0.0.0.31 | 32 | 30 | |
/28 | 255.255.255.240 | 0.0.0.15 | 16 | 14 | |
/29 | 255.255.255.248 | 0.0.0.7 | 8 | 6 | |
/30 | 255.255.255.252 | 0.0.0.3 | 4 | 2 | classic router link |
/31 | 255.255.255.254 | 0.0.0.1 | 2 | 2 | no broadcast, RFC 3021 |
/32 | 255.255.255.255 | 0.0.0.0 | 1 | 1 | a single host |
The two formulas
addresses = 2 ^ (32 - prefix)
usable = 2 ^ (32 - prefix) - 2 except /31 and /32
Going the other way, from a host requirement to a prefix: add two, round up to the next power of two, and that is your block size. See network, broadcast and usable hosts for the worked version.
Powers of two
The only table underneath all of this. Everything else is derived from it.
2^1 = 2 2^7 = 128 2^13 = 8,192 2^2 = 4 2^8 = 256 2^14 = 16,384 2^3 = 8 2^9 = 512 2^15 = 32,768 2^4 = 16 2^10 = 1,024 2^16 = 65,536 2^5 = 32 2^11 = 2,048 2^20 = 1,048,576 2^6 = 64 2^12 = 4,096 2^24 = 16,777,216
Mask octet values
A mask octet can only be one of these nine, because a mask is always ones followed by zeros. The block size column is 256 minus the value, which is the fastest route to a boundary.
| Decimal | Binary | Ones | Block size |
|---|---|---|---|
0 | 00000000 | 0 | 256 |
128 | 10000000 | 1 | 128 |
192 | 11000000 | 2 | 64 |
224 | 11100000 | 3 | 32 |
240 | 11110000 | 4 | 16 |
248 | 11111000 | 5 | 8 |
252 | 11111100 | 6 | 4 |
254 | 11111110 | 7 | 2 |
255 | 11111111 | 8 | 1 |
Reserved and special-purpose ranges
| Range | Name | What it means |
|---|---|---|
10.0.0.0/8 | Private | RFC 1918. Businesses, data centers, VPNs |
172.16.0.0/12 | Private | RFC 1918. Common inside containers |
192.168.0.0/16 | Private | RFC 1918. Home routers |
100.64.0.0/10 | Carrier-grade NAT | RFC 6598. Shared provider address |
127.0.0.0/8 | Loopback | This machine. Never leaves it |
169.254.0.0/16 | Link-local | Self-assigned. Usually means DHCP failed |
224.0.0.0/4 | Multicast | One to many delivery |
192.0.2.0/24 | Documentation | RFC 5737. Safe in examples |
198.51.100.0/24 | Documentation | RFC 5737 |
203.0.113.0/24 | Documentation | RFC 5737. Used throughout this site |
0.0.0.0/0 | Default route | Every address. Anywhere in a firewall rule |
Common IPv6 prefixes
Host counting stops being useful in IPv6, so the conventions are about structure instead.
| Prefix | Typically |
|---|---|
/48 | An allocation to a site or organization |
/56 | A common residential allocation |
/64 | One network segment. The standard subnet size |
/127 | A point-to-point link, the IPv6 equivalent of /31 |
/128 | A single host |
A single /64 holds about 18 quintillion addresses, which is more than the whole IPv4 internet squared. Nobody subnets IPv6 to save addresses.