LEARN · Subnetting

CIDR CHEAT SHEET

By Richard Lucht · Published

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:

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

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

RELATED GUIDES