LEARN · Subnetting
CIDR CHEAT SHEET
CIDR notation packs a subnet mask into a single number after a slash. It replaced the old Class A, B and C system in 1993 because fixed class sizes wasted huge amounts of address space. Today every IPv4 route, firewall object and cloud subnet is written as an address and a prefix length.
The table below covers every prefix you’re likely to meet, from /8 to /32. All values are calculated, not typed by hand.
The full table
“Octet” is the octet the prefix ends in, and “block” is how far apart subnets start within that octet. Usable hosts subtract the network and broadcast addresses, except for /31 and /32.
| Prefix | Subnet mask | Wildcard mask | Octet | Block | Addresses | Usable hosts |
|---|---|---|---|---|---|---|
| /8 | 255.0.0.0 | 0.255.255.255 | 1 | 1 | 16,777,216 | 16,777,214 |
| /9 | 255.128.0.0 | 0.127.255.255 | 2 | 128 | 8,388,608 | 8,388,606 |
| /10 | 255.192.0.0 | 0.63.255.255 | 2 | 64 | 4,194,304 | 4,194,302 |
| /11 | 255.224.0.0 | 0.31.255.255 | 2 | 32 | 2,097,152 | 2,097,150 |
| /12 | 255.240.0.0 | 0.15.255.255 | 2 | 16 | 1,048,576 | 1,048,574 |
| /13 | 255.248.0.0 | 0.7.255.255 | 2 | 8 | 524,288 | 524,286 |
| /14 | 255.252.0.0 | 0.3.255.255 | 2 | 4 | 262,144 | 262,142 |
| /15 | 255.254.0.0 | 0.1.255.255 | 2 | 2 | 131,072 | 131,070 |
| /16 | 255.255.0.0 | 0.0.255.255 | 2 | 1 | 65,536 | 65,534 |
| /17 | 255.255.128.0 | 0.0.127.255 | 3 | 128 | 32,768 | 32,766 |
| /18 | 255.255.192.0 | 0.0.63.255 | 3 | 64 | 16,384 | 16,382 |
| /19 | 255.255.224.0 | 0.0.31.255 | 3 | 32 | 8,192 | 8,190 |
| /20 | 255.255.240.0 | 0.0.15.255 | 3 | 16 | 4,096 | 4,094 |
| /21 | 255.255.248.0 | 0.0.7.255 | 3 | 8 | 2,048 | 2,046 |
| /22 | 255.255.252.0 | 0.0.3.255 | 3 | 4 | 1,024 | 1,022 |
| /23 | 255.255.254.0 | 0.0.1.255 | 3 | 2 | 512 | 510 |
| /24 | 255.255.255.0 | 0.0.0.255 | 3 | 1 | 256 | 254 |
| /25 | 255.255.255.128 | 0.0.0.127 | 4 | 128 | 128 | 126 |
| /26 | 255.255.255.192 | 0.0.0.63 | 4 | 64 | 64 | 62 |
| /27 | 255.255.255.224 | 0.0.0.31 | 4 | 32 | 32 | 30 |
| /28 | 255.255.255.240 | 0.0.0.15 | 4 | 16 | 16 | 14 |
| /29 | 255.255.255.248 | 0.0.0.7 | 4 | 8 | 8 | 6 |
| /30 | 255.255.255.252 | 0.0.0.3 | 4 | 4 | 4 | 2 |
| /31 | 255.255.255.254 | 0.0.0.1 | 4 | 2 | 2 | 2 |
| /32 | 255.255.255.255 | 0.0.0.0 | 4 | 1 | 1 | 1 |
How to read it without memorizing it
The table repeats the same eight-step pattern in every octet. Moving down one row adds one network bit, which halves the block size and the number of addresses. So you only need one anchor:
- /24 is 256 addresses. Each step down halves it: /25 is 128, /26 is 64, /27 is 32, and so on to /30 at 4.
- Each step up doubles it: /23 is 512, /22 is 1,024, /21 is 2,048, and /16 is 65,536.
The mask octet values are the running total of the bits in a byte from the left: 128, then 128 + 64 = 192, then 224, 240, 248, 252, 254 and 255. The block size is always 256 minus that value. The wildcard octet is 255 minus that value, which is just the block size minus one.
Prefixes you will see every week
- /32: a single host. Loopback interfaces, host routes and firewall objects for one server.
- /31: point-to-point router links where both ends support RFC 3021. It saves half the addresses of a /30.
- /30: the traditional point-to-point link: 4 addresses, 2 usable.
- /29 and /28: small public blocks from ISPs, DMZs and management segments.
- /24: the default LAN size, 254 hosts. Most home and branch networks.
- /22 and /21: large user VLANs, wireless and campus networks.
- /16, /12 and /8: summaries and private address plans. The RFC 1918 private ranges are
10.0.0.0/8,172.16.0.0/12and192.168.0.0/16. - /0: the default route,
0.0.0.0/0, which matches every address.
Masks, wildcards and prefixes in the wild
Different tools ask for the same thing in different forms. Linux and most cloud consoles use the prefix (/27). Windows network settings and older gear ask for the dotted mask (255.255.255.224). Cisco ACLs and OSPF network statements take the wildcard (0.0.0.31). Keeping all three on one row is the point of this table.
A common slip is typing a mask where a wildcard belongs. On a Cisco router, access-list 10 permit 10.1.1.0 255.255.255.0 doesn’t mean “this /24.” The wildcard tells the router to ignore the first three octets and check only the last one, so it matches any address ending in .0. The rule you wanted is access-list 10 permit 10.1.1.0 0.0.0.255.
Practice
Tables are for checking answers, not for finding them. Use Subnetle to practice working out subnets from the pattern, and come back here when you need to check a row.
Practice it: Subnetle puts this into a daily game, free in your browser.
FAQ
What does the number after the slash mean?
It is the prefix length: how many bits, counted from the left, belong to the network. 192.168.1.0/24 means the first 24 bits (192.168.1) identify the network and the last 8 bits identify hosts.
What is a wildcard mask?
The subnet mask with every bit flipped. Cisco ACLs and OSPF network statements use it to say which bits must match (0) and which can be anything (1). For any prefix, each wildcard octet is 255 minus the mask octet.
Are Class A, B and C still used?
Not for routing. Classful addressing was replaced by CIDR in 1993. The old class boundaries survive only as habits: people still call a /24 a 'Class C sized' network, and some exam questions still mention classes.
Why does a /31 have two usable addresses?
RFC 3021 allows /31s on point-to-point links. With only two hosts there is no need for a broadcast address, so both addresses are assigned, one to each end. Most modern routers support it.
SOURCES
- RFC 4632: Classless Inter-domain Routing (CIDR)
- RFC 3021: Using 31-Bit Prefixes on IPv4 Point-to-Point Links
- RFC 1918: Address Allocation for Private Internets