Subnet Mask Cheat Sheet: CIDR /8 to /32
This chart maps every CIDR prefix from /8 to /32 to its subnet mask, wildcard mask, total addresses, and usable hosts. Use it when you need the answer fast. The sections below explain how to read it and which sizes are used for what. To work out a specific network, use the subnet calculator.
CIDR to subnet mask chart
| Prefix | Subnet mask | Wildcard mask | Total addresses | Usable hosts |
|---|---|---|---|---|
| /8 | 255.0.0.0 | 0.255.255.255 | 16,777,216 | 16,777,214 |
| /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 |
| /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 |
| /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 |
| /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 |
| /31 | 255.255.255.254 | 0.0.0.1 | 2 | 2 |
| /32 | 255.255.255.255 | 0.0.0.0 | 1 | 1 |
Usable hosts = total addresses − 2 (the network and broadcast addresses). The exceptions are /31, where both addresses are usable on a point-to-point link (RFC 3021), and /32, which is a single host address.
How to read a subnet mask in 30 seconds
Every subnet mask is a run of 1 bits followed by a run of 0 bits, and the prefix length is the number of 1s. Each octet holds 8 bits, so /24 fills exactly three octets (255.255.255.0), while any prefix in between fills part of one octet.
For a mask that cuts through an octet, find the "interesting octet": the one that is neither 255 nor 0. The block size is 256 minus that octet's value. For /27 the mask is 255.255.255.224, the interesting octet is the last one, and 256 − 224 = 32, so subnets start at multiples of 32: .0, .32, .64, .96, .128, .160, .192, and .224. For /20 (255.255.240.0) the interesting octet is the third one and the block size is 16, so subnets in 10.1.0.0 begin at 10.1.0.0, 10.1.16.0, 10.1.32.0, and so on.
To find the subnet an address belongs to, round the interesting octet down to the nearest multiple of the block size. Take 172.16.45.9/20: the third octet is 45, the block size is 16, and the nearest multiple at or below 45 is 32. The network is 172.16.32.0, the next network starts at 172.16.48.0, and the broadcast address is therefore 172.16.47.255.
The binary view
A /26 mask written in binary is 11111111.11111111.11111111.11000000, which is 255.255.255.192. The wildcard mask is the exact inverse, 00000000.00000000.00000000.00111111, which is 0.0.0.63. The six remaining host bits give 26 = 64 addresses and 62 usable hosts.
The addresses you can't use
In an ordinary IPv4 subnet the first address is the network address and the last is the broadcast address, so neither can be assigned to a host. That is where the formula comes from: usable hosts = 2(32 − prefix) − 2. A /24 has 256 addresses and 254 usable; a /29 has 8 addresses and 6 usable.
Two prefixes break the rule. A /31 has two addresses, and under RFC 3021 both can be used on a point-to-point link because there is no need for a broadcast address. Some older equipment does not support this, so /30 is still common. A /32 is one address, used for loopback interfaces, host routes, and firewall rules that match exactly one machine.
Cloud networks reserve more. AWS and Azure each reserve five addresses in every subnet, so a /28 gives 11 usable addresses rather than 14, and Google Cloud reserves four in a subnet's primary range. Check your provider's current documentation before sizing a cloud subnet to an exact host count.
Which prefix length for which job
- /8 to /15: very large blocks. These are allocations or whole private ranges such as 10.0.0.0/8 that get divided further; they are never a single network segment.
- /16: a whole site, campus, or cloud VPC. See the /16 guide.
- /20 to /22: a large site's block, or a big virtualization or Wi-Fi network. A /22 gives 1,022 hosts.
- /23: 510 hosts. Common when a /24 runs out of room, for example on a busy wireless network.
- /24: the default LAN size, with 254 hosts. See the /24 guide.
- /25 and /26: 126 and 62 hosts. Departments, floors, or voice and camera VLANs.
- /27: 30 hosts. A small office or a management VLAN. See the /27 guide.
- /28: 14 hosts. A DMZ, a lab, or a small server group.
- /29: 6 hosts. A tiny segment, or an internet handoff from a provider with a few public addresses.
- /30 and /31: two hosts. Point-to-point links between routers.
- /32: one host. Loopbacks and host routes.
Common mistakes
- Treating the typed address as the network. 192.168.1.77/26 is a host inside the network 192.168.1.64/26, not a network address itself.
- Mixing up subnet masks and wildcard masks. Interfaces take a subnet mask (255.255.255.0); Cisco ACLs and OSPF network statements take a wildcard mask (0.0.0.255). The wildcard mask calculator converts between them.
- Sizing to the exact host count. Leave 20 to 30 percent for growth, and remember that a gateway and redundant routers also use addresses.
- Using a non-contiguous mask. A subnet mask must be all 1s then all 0s. 255.255.0.255 is not a valid subnet mask.
- Assuming .0 and .255 are never usable. They are only the network and broadcast addresses when they sit at the edge of the subnet. In 192.168.0.0/23 the address 192.168.0.255 is a perfectly valid host, and 192.168.1.0 is too.
Related tools and guides
Frequently asked questions
What is the subnet mask for /24?
A /24 uses the subnet mask 255.255.255.0 and provides 256 addresses, of which 254 are usable for hosts.
How many hosts are in a /26?
A /26 has 64 addresses in total and 62 usable hosts, because the network and broadcast addresses cannot be assigned to devices. Its subnet mask is 255.255.255.192.
How do I convert a subnet mask to CIDR notation?
Count the 1 bits in the mask. For 255.255.240.0 the first two octets contribute 8 + 8 and the third octet 240 contributes 4 (11110000), so the prefix is /20.
What is the difference between a subnet mask and a wildcard mask?
A wildcard mask is the bitwise inverse of a subnet mask. The subnet mask 255.255.255.0 corresponds to the wildcard mask 0.0.0.255. Subnet masks are used on interfaces and hosts, while wildcard masks are used in Cisco ACLs and routing protocol network statements.