Subnet Mask Cheat Sheet
This subnet mask cheat sheet lists every CIDR prefix from /0 to /32. Filter by CIDR, mask, wildcard, or host count.
- /24 = 255.255.255.0 — 254 usable hosts
- /25 = 255.255.255.128 — 126 usable hosts
- /26 = 255.255.255.192 — 62 usable hosts
- /30 = 255.255.255.252 — 2 usable hosts
- /31 = 255.255.255.254 — 2 hosts (point-to-point)
| CIDR | Subnet Mask | Wildcard Mask | Total Addresses | Usable Hosts | Copy |
|---|---|---|---|---|---|
| /0 | 0.0.0.0 | 255.255.255.255 | 4,294,967,296 | 4,294,967,294 | |
| /1 | 128.0.0.0 | 127.255.255.255 | 2,147,483,648 | 2,147,483,646 | |
| /2 | 192.0.0.0 | 63.255.255.255 | 1,073,741,824 | 1,073,741,822 | |
| /3 | 224.0.0.0 | 31.255.255.255 | 536,870,912 | 536,870,910 | |
| /4 | 240.0.0.0 | 15.255.255.255 | 268,435,456 | 268,435,454 | |
| /5 | 248.0.0.0 | 7.255.255.255 | 134,217,728 | 134,217,726 | |
| /6 | 252.0.0.0 | 3.255.255.255 | 67,108,864 | 67,108,862 | |
| /7 | 254.0.0.0 | 1.255.255.255 | 33,554,432 | 33,554,430 | |
| /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 |
Subnet mask octet values
Each subnet mask octet is one of nine values. The value depends on how many bits are set inside that octet. Use this table to read or build any mask by hand.
| Mask Octet | Binary | Wildcard Octet | Network Bits |
|---|---|---|---|
| 0 | 00000000 | 255 | 0 |
| 128 | 10000000 | 127 | 1 |
| 192 | 11000000 | 63 | 2 |
| 224 | 11100000 | 31 | 3 |
| 240 | 11110000 | 15 | 4 |
| 248 | 11111000 | 7 | 5 |
| 252 | 11111100 | 3 | 6 |
| 254 | 11111110 | 1 | 7 |
| 255 | 11111111 | 0 | 8 |
How to read this subnet mask cheat sheet
Each row maps one CIDR prefix to its subnet mask, wildcard mask, total address count, and usable host count. The prefix counts the network bits. The remaining bits become host bits that number the devices inside the subnet.
Read the table in either direction. Start from a CIDR prefix like /26 to find its mask. Or start from a mask like 255.255.255.192 to find its prefix. The subnet calculator works out full ranges for a specific address.
How to calculate usable hosts
Usable hosts equal 2 raised to the host-bit count, minus 2. Host bits equal 32 minus the prefix length. The subtraction removes the network address and the broadcast address, which cannot be assigned to devices.
A /24 has 8 host bits, so it holds 256 addresses and 254 usable hosts. A /26 has 6 host bits, giving 64 addresses and 62 usable hosts. Two prefixes break this rule.
The /31 exception (point-to-point links)
A /31 gives both addresses to hosts, so it has two usable hosts, not zero. RFC 3021 defined this for point-to-point links. It saves address space, since each router link needs only two addresses. Cisco IOS has supported it since release 12.2(2)T.
The /32 exception (host routes)
A /32 describes a single address with the mask 255.255.255.255. It has one usable host. Engineers use it for host routes, loopback interfaces, and firewall rules that match one exact IP.
Wildcard masks and where you use them
A wildcard mask is the inverse of a subnet mask. Subtract each mask octet from 255 to get it. A 0 bit means the position must match, and a 1 bit means it can vary. Cisco access lists and OSPF network statements use wildcard masks.
For a /24, the subnet mask 255.255.255.0 becomes the wildcard mask 0.0.0.255. Convert any mask with the IP binary converter, or plan blocks with the CIDR to IP range converter.
Worked subnet mask examples
These examples show how to move between prefix, mask, and host count using the cheat sheet above.
- Need 50 hosts: a
/26gives 62 usable hosts, the smallest fit. A/27gives only 30. - Given 255.255.255.240: that octet sets 4 bits, so the prefix is
/28with 14 usable hosts. - Router link: use a
/30for 2 usable hosts, or a/31to save two addresses per link.
Common subnet mask mistakes
Two errors cause most subnetting confusion. Watch for both when you read the cheat sheet.
- Forgetting the minus 2: total addresses include the network and broadcast. Usable hosts are always two fewer, except on a
/31and/32. - Confusing the two masks: a subnet mask starts with 255s, while a wildcard mask starts with 0s. Cisco tools expect the wildcard form.
Related tools and resources
Explore more free networking tools. Size a network with the subnet calculator. Expand a block with the CIDR to IP range converter. Convert addresses with the IP binary converter. Look up services with the port number reference. To go deeper, read the subnetting beginner’s guide or VLSM and supernetting. Related background covers public vs private IP addresses, IPv4 vs IPv6, and how masks shape firewall rules.
References
- RFC 1878 — Variable Length Subnet Table for IPv4.
- RFC 4632 — Classless Inter-Domain Routing (CIDR).
- RFC 3021 — Using 31-bit prefixes on IPv4 point-to-point links.