Subnet Cheat Sheet

Everything you need to subnet IPv4 by hand, on one page you can keep next to the console.

Download PDF (A4) Free to print and share in classrooms. No email needed.

Subnetting Cheat Sheet

3rd octet: /16 → /23 (255.255.x.0)

CIDRxBlockHosts
/16025665,534
/1712812832,766
/181926416,382
/19224328,190
/20240164,094
/2124882,046
/2225241,022
/232542510

4th octet: /24 → /32 (255.255.255.x)

CIDRxBlockHosts
/240256254
/25128128126
/261926462
/272243230
/282401614
/2924886
/3025242
/3125422*
/3225511

* /31 = point-to-point, both usable (RFC 3021)

wildcard octet = block − 1  ·  /8–/15: same in the 2nd octet

VLSM in 4 steps

1sort biggest → smallest

2hosts + 2 → next power of 2

3place at next free multiple

4leave room to grow!

Powers of 2

2142831643256461287256851291,024102,048114,09612
The magic number block size = 256 − interesting octet
/27 → 256 − 224 = 32
/20 → 256 − 240 = 16 (3rd octet!)

Subnet it in your head

192.168.10.77/26

1block = 256 − 192 = 64

20, 64, 128 … 77 lives in 64–127

3net .64 · bcast .127 · hosts .65–.126

10.1.77.200/20 ← 3rd octet!

1block = 256 − 240 = 16

277 ÷ 16 = 4 r13 → 64

3net 10.1.64.0 · bcast 10.1.79.255

Private & special

10/8 · 172.16/12 · 192.168/16 private

100.64/10 CGNAT · 169.254/16 no DHCP

127/8 loopback · 224/4 multicast

docs: 192.0.2/24 · 198.51.100/24 · 203.0.113/24

watch out: 172.32.x.x is PUBLIC
keep me next to the console ✎subnetcalculator.dev

Full CIDR table /0 to /32

Every IPv4 prefix with mask, wildcard, block size and usable hosts
CIDRSubnet maskWildcardBlock sizeUsable hosts
/0 0.0.0.0 255.255.255.255 — 4,294,967,294
/1 128.0.0.0 127.255.255.255 128 (first) 2,147,483,646
/2 192.0.0.0 63.255.255.255 64 (first) 1,073,741,822
/3 224.0.0.0 31.255.255.255 32 (first) 536,870,910
/4 240.0.0.0 15.255.255.255 16 (first) 268,435,454
/5 248.0.0.0 7.255.255.255 8 (first) 134,217,726
/6 252.0.0.0 3.255.255.255 4 (first) 67,108,862
/7 254.0.0.0 1.255.255.255 2 (first) 33,554,430
/8 255.0.0.0 0.255.255.255 1 (first) 16,777,214
/9 255.128.0.0 0.127.255.255 128 (second) 8,388,606
/10 255.192.0.0 0.63.255.255 64 (second) 4,194,302
/11 255.224.0.0 0.31.255.255 32 (second) 2,097,150
/12 255.240.0.0 0.15.255.255 16 (second) 1,048,574
/13 255.248.0.0 0.7.255.255 8 (second) 524,286
/14 255.252.0.0 0.3.255.255 4 (second) 262,142
/15 255.254.0.0 0.1.255.255 2 (second) 131,070
/16 255.255.0.0 0.0.255.255 1 (second) 65,534
/17 255.255.128.0 0.0.127.255 128 (third) 32,766
/18 255.255.192.0 0.0.63.255 64 (third) 16,382
/19 255.255.224.0 0.0.31.255 32 (third) 8,190
/20 255.255.240.0 0.0.15.255 16 (third) 4,094
/21 255.255.248.0 0.0.7.255 8 (third) 2,046
/22 255.255.252.0 0.0.3.255 4 (third) 1,022
/23 255.255.254.0 0.0.1.255 2 (third) 510
/24 255.255.255.0 0.0.0.255 1 (third) 254
/25 255.255.255.128 0.0.0.127 128 (fourth) 126
/26 255.255.255.192 0.0.0.63 64 (fourth) 62
/27 255.255.255.224 0.0.0.31 32 (fourth) 30
/28 255.255.255.240 0.0.0.15 16 (fourth) 14
/29 255.255.255.248 0.0.0.7 8 (fourth) 6
/30 255.255.255.252 0.0.0.3 4 (fourth) 2
/31 255.255.255.254 0.0.0.1 2 (fourth) 2
/32 255.255.255.255 0.0.0.0 1 (fourth) 1

How to use the block-size trick

Look for the first octet of the mask that isn't 255. Subtract it from 256: that is the block size, and networks start at every multiple of it in that octet. Round your address's octet down to the nearest multiple to get the network, and add the block size minus one to get the broadcast. Octets to the right become 0 for the network and 255 for the broadcast.

Try it in the subnetting practice trainer: every answer shows these steps with the bits and blocks drawn out.

FAQ

How do I memorise subnet masks?

Learn the eight mask octet values in order: 128, 192, 224, 240, 248, 252, 254, 255. Each adds one more bit. The block size is 256 minus that value: 128, 64, 32, 16, 8, 4, 2, 1. With those two rows you can work out any mask.

Why does /31 have 2 usable hosts?

RFC 3021 allows /31 on point-to-point links, where a network and broadcast address are pointless. Both addresses are usable. Every other prefix up to /30 loses two addresses to network and broadcast.

Can I print this for a class?

Yes. Download the PDF or press Print; the page prints on one A4 or Letter sheet. You are welcome to share it with students, no sign-up needed.

More sheets: wildcard mask · IPv6 · Tools: subnet calculator · VLSM calculator · prefix reference