Cheat Sheet

Subnetting Cheat Sheet: CIDR, Masks and Block Sizes

Subnetting cheat sheet with a full CIDR and subnet mask table, block sizes, worked examples, VLSM and private ranges for Network+ and A+.

By CompCertQuiz Editorial · Published · Last reviewed · 8 min read

Part of the Network+ N10-009 study hub: CompTIA Network+ Study Guide (N10-009): 5 Domains

Subnetting is easier with a reference in front of you. This subnetting cheat sheet has the CIDR table (prefix, subnet mask, wildcard mask and host counts), the block-size method for doing it by hand, worked examples, the private and special address ranges and a VLSM example. Two formulas cover most problems: usable hosts = 2(32 - prefix) - 2, and block size = 256 - the mask value in the interesting octet.

CIDR cheat sheet: prefix, subnet mask and hosts

This is the subnet mask cheat sheet for every prefix from /8 to /32. A /31 has two usable addresses on point-to-point links (RFC 3021) and a /32 is a single host.

PrefixSubnet maskWildcard maskTotal addressesUsable hosts
/8255.0.0.00.255.255.25516,777,21616,777,214
/9255.128.0.00.127.255.2558,388,6088,388,606
/10255.192.0.00.63.255.2554,194,3044,194,302
/11255.224.0.00.31.255.2552,097,1522,097,150
/12255.240.0.00.15.255.2551,048,5761,048,574
/13255.248.0.00.7.255.255524,288524,286
/14255.252.0.00.3.255.255262,144262,142
/15255.254.0.00.1.255.255131,072131,070
/16255.255.0.00.0.255.25565,53665,534
/17255.255.128.00.0.127.25532,76832,766
/18255.255.192.00.0.63.25516,38416,382
/19255.255.224.00.0.31.2558,1928,190
/20255.255.240.00.0.15.2554,0964,094
/21255.255.248.00.0.7.2552,0482,046
/22255.255.252.00.0.3.2551,0241,022
/23255.255.254.00.0.1.255512510
/24255.255.255.00.0.0.255256254
/25255.255.255.1280.0.0.127128126
/26255.255.255.1920.0.0.636462
/27255.255.255.2240.0.0.313230
/28255.255.255.2400.0.0.151614
/29255.255.255.2480.0.0.786
/30255.255.255.2520.0.0.342
/31255.255.255.2540.0.0.122
/32255.255.255.2550.0.0.011

You do not need to memorize all 25 rows. Learn the last-octet masks below and the powers of two, and you can rebuild any row in seconds.

The last-octet masks to memorize

Most exam problems land in the fourth octet, where the mask values are 128, 192, 224, 240, 248 and 252. The block size is the distance between subnets, and it equals 256 minus the mask value.

PrefixMask in the last octetBlock sizeUsable hosts
/25128128126
/261926462
/272243230
/282401614
/2924886
/3025242

Powers of two

Host bits2 to the powerTotal addressesUsable hosts
12^122 (/31 only)
22^242
32^386
42^41614
52^53230
62^66462
72^7128126
82^8256254
92^9512510
102^1010241022

Host bits = 32 minus the prefix. A /26 leaves 6 host bits, so there are 26 = 64 addresses and 62 usable hosts.

The block-size method, step by step

  1. Convert the prefix to a mask. A /26 is 255.255.255.192.
  2. Find the interesting octet: the one where the mask is not 255 or 0. For /26 it is the fourth octet (192).
  3. Block size = 256 minus the mask value. 256 - 192 = 64.
  4. List the subnet boundaries in that octet: 0, 64, 128, 192.
  5. Find the boundary at or below the address. That is the network address. The next boundary minus 1 is the last address (the broadcast address).
  6. First usable host = network address + 1. Last usable host = broadcast address - 1.

Worked examples

192.168.10.77/26

ItemValue
Subnet mask255.255.255.192
Network address192.168.10.64
First usable host192.168.10.65
Last usable host192.168.10.126
Broadcast address192.168.10.127
Usable hosts62

172.20.45.9/20

ItemValue
Subnet mask255.255.240.0
Network address172.20.32.0
First usable host172.20.32.1
Last usable host172.20.47.254
Broadcast address172.20.47.255
Usable hosts4,094

10.200.3.4/9

ItemValue
Subnet mask255.128.0.0
Network address10.128.0.0
First usable host10.128.0.1
Last usable host10.255.255.254
Broadcast address10.255.255.255
Usable hosts8,388,606

Check your own answers against these with the free subnet calculator, and drill with unlimited random problems in the subnetting practice tool.

VLSM example: four subnets from one /24

Variable length subnet masks (VLSM) let you give each subnet only the size it needs. Sort the requirements from largest to smallest, give each the smallest subnet that fits, and place them one after another. Here is 192.168.1.0/24 split for 100, 50, 25 and 10 hosts:

NeedsSubnetMaskUsable hostsBroadcast
100 hosts192.168.1.0/25255.255.255.128126192.168.1.127
50 hosts192.168.1.128/26255.255.255.19262192.168.1.191
25 hosts192.168.1.192/27255.255.255.22430192.168.1.223
10 hosts192.168.1.224/28255.255.255.24014192.168.1.239

The four subnets use 192.168.1.0 through 192.168.1.239, leaving 192.168.1.240 to 192.168.1.255 free for growth. VLSM and CIDR are both listed under Network+ objective 1.7, see the Network+ N10-009 study guide.

Private and special IPv4 ranges

RangePurposeReference
10.0.0.0/8Private (Class A size)RFC 1918
172.16.0.0/12Private (172.16.0.0 to 172.31.255.255)RFC 1918
192.168.0.0/16Private (Class C size blocks)RFC 1918
169.254.0.0/16APIPA / link-local, self-assigned when DHCP failsRFC 3927
127.0.0.0/8Loopback (127.0.0.1 is localhost)RFC 1122
100.64.0.0/10Shared address space for carrier-grade NATRFC 6598
224.0.0.0/4MulticastRFC 5771
0.0.0.0/0Default route, matches every addressn/a

Read the details in RFC 1918, RFC 3927 and RFC 6598.

IPv4 address classes

Classful addressing is no longer used for routing, but Network+ still lists the five classes, so know the first-octet ranges.

ClassFirst octetDefault maskUse
A1 to 126255.0.0.0 (/8)Very large networks
B128 to 191255.255.0.0 (/16)Medium networks
C192 to 223255.255.255.0 (/24)Small networks
D224 to 239n/aMulticast
E240 to 255n/aReserved

The 127.x.x.x range is reserved for loopback and sits between Class A and Class B.

Common subnetting mistakes

  • Forgetting to subtract 2. The network and broadcast addresses are not usable hosts. A /24 has 254 usable hosts, not 256.
  • Using the wrong octet. A /20 puts the interesting octet in the third octet (mask 240), not the fourth. Find the octet first.
  • Mixing up the block size and the mask. For /26 the mask value is 192 and the block size is 64. Subnets start at multiples of 64, not 192.
  • Picking a subnet that is too small. Count hosts needed plus 2, then round up to the next power of two. Needing 30 hosts means a /27 (30 usable) at the tightest, and needing 31 means a /26.
  • Treating a /30 and a /31 alike. A /30 has two usable hosts and a network and broadcast address. A /31 uses both addresses on a point-to-point link.

Practice and next steps

  1. Do 10 problems a day in the subnetting practice tool at beginner level until you are fast, then move to intermediate and advanced.
  2. Check your work with the subnet calculator.
  3. Learn the ports next with the Network+ ports and protocols cheat sheet.
  4. Test yourself on realistic questions: Network+ N10-009 practice questions (40 free) or the free A+ Core 1 practice test.

Frequently asked questions

How do I calculate usable hosts?

Raise 2 to the number of host bits (32 minus the prefix) and subtract 2. A /27 has 5 host bits, so 2^5 - 2 = 30 usable hosts.

What is the wildcard mask?

The inverse of the subnet mask. Subtract each mask octet from 255. The wildcard for 255.255.255.192 is 0.0.0.63. Cisco access lists and OSPF network statements use it.

What is a subnet mask cheat sheet used for?

It lets you look up the mask, block size and host count for a prefix without converting to binary each time, which saves time on Network+ and A+ questions.

Is subnetting on the Network+ exam?

Yes. Network+ N10-009 objective 1.7 covers IPv4 addressing, including subnetting, VLSM, CIDR and address classes.

CompCertQuiz is an independent practice-exam site and is not affiliated with, endorsed by, or sponsored by CompTIA. Our practice questions are original material written for exam preparation. CompTIA and its certification names are trademarks of CompTIA, Inc. Always confirm exam details on comptia.org.

More from the blog