Subnet Cheat Sheet

crackr.dev

1Subnet Reference — 4th Octet (/24–/32)

CIDRMaskBlockUsableNets*
/24255.255.255.02562541
/25255.255.255.1281281262
/26255.255.255.19264624
/27255.255.255.22432308
/28255.255.255.240161416
/29255.255.255.2488632
/30255.255.255.2524264
/31255.255.255.25422128
/32255.255.255.25511256

*Subnets within a /24. Usable = 2ⁿ−2 (except /31 P2P and /32 host).

2Subnet Reference — 3rd Octet (/16–/23)

CIDRMaskBlockUsable
/16255.255.0.0256×65,534
/17255.255.128.0128×32,766
/18255.255.192.064×16,382
/19255.255.224.032×8,190
/20255.255.240.016×4,094
/21255.255.248.02,046
/22255.255.252.01,022
/23255.255.254.0510

Block = number of /24-sized blocks in this subnet.

Class-scale Prefixes

/8255.0.0.0
16,777,214
/12255.240.0.0
1,048,574
/16255.255.0.0
65,534
/24255.255.255.0
254

3How Subnetting Works

The subnet mask splits the IP into two parts

192.168.1.100 / 26

IP
11000000.10101000.00000001.01100100
Mask
11111111.11111111.11111111.11000000
AND
11000000.10101000.00000001.01000000
Network — 26 bits
Host 6b

Result: Everything you need

Network192.168.1.64
Broadcast192.168.1.127
First host192.168.1.65
Last host192.168.1.126
Usable hosts62
Next subnet192.168.1.128

4Subnet Splitting — Visual

A /24 can be split into smaller equal subnets

/24 (254)/25 (126)/25 (126)/26 (62)/26 (62)/26 (62)/26 (62)/27/27/27/27/27/27/27/27/28/28/28/28/28/28/28/28/28/28/28/28/28/28/28/28Each split doubles the subnets, halves the hosts/24 → 2×/25 → 4×/26 → 8×/27 → 16×/28 → 32×/29 → 64×/30

5The Magic Number — Fastest Method

Find any network/broadcast/range in 3 steps

1

Find the interesting octet

The mask octet that's not 255 or 0

2

Magic number = 256 − mask value

This is your block size (subnet increment)

3

Subnets start at multiples of magic number

Find which block your IP falls in

Example: 172.16.45.200 /26

Mask octet:255.255.255.192
Magic number:256 − 192 = 64
Subnets at:.0  .64  .128  .192  .256
200 falls in:.192 – .255
Network:172.16.45.192
Broadcast:172.16.45.255
First host:.193
Last host:.254

6Private Ranges (RFC 1918)

10.0.0.0/8Class A
10.0.0.010.255.255.255

16,777,214 usable hosts

172.16.0.0/12Class B
172.16.0.0172.31.255.255

1,048,574 usable hosts

192.168.0.0/16Class C
192.168.0.0192.168.255.255

65,534 usable hosts

Other Reserved

127.0.0.0/8Loopback
169.254.0.0/16Link-local
100.64.0.0/10CGNAT
0.0.0.0/0Default route

7Wildcard Masks

Wildcard = 255.255.255.255 − subnet mask

CIDRSubnet MaskWildcard
/8255.0.0.00.255.255.255
/16255.255.0.00.0.255.255
/24255.255.255.00.0.0.255
/25255.255.255.1280.0.0.127
/26255.255.255.1920.0.0.63
/27255.255.255.2240.0.0.31
/28255.255.255.2400.0.0.15
/29255.255.255.2480.0.0.7
/30255.255.255.2520.0.0.3
0 = must match
255 = any value

Used in Cisco ACLs and OSPF area configs.

8Valid Mask Octets & Binary

Only 9 values are legal in any subnet mask octet. Masks are always contiguous 1s then 0s.

0
00000000
all host
128
10000000
1 net bits
192
11000000
2 net bits
224
11100000
3 net bits
240
11110000
4 net bits
248
11111000
5 net bits
252
11111100
6 net bits
254
11111110
7 net bits
255
11111111
all network

Bit Position Values

128

2

64

2

32

2

16

2

8

2³

4

2²

2

2¹

1

2

9VLSM — Variable Length Subnet Masking

Use different-sized subnets to avoid wasting IPs

Allocate 192.168.1.0/24 — sorted by need

LAN A /25100 hosts → 126
LAN B /2650 → 62
LAN C /2725→30
P2P
free
LAN A/25.0 – .127126h
LAN B/26.128 – .19162h
LAN C/27.192 – .22330h
P2P/30.224 – .2272h

Steps

  1. 1. Sort subnets largest-need first
  2. 2. Pick smallest CIDR that fits each
  3. 3. Allocate sequentially, never overlap

10Classful Addressing (Legacy)

Replaced by CIDR, but still referenced in exams

Class A0–127/8 — N.H.H.HClass B128–191/16 — N.N.H.HClass C192–223/24 — N.N.N.HClass D224–239MulticastClass E240–255Reserved

N = Network, H = Host. Class D/E have no host addressing.

11Key Formulas & Rules

Usable hosts = 2ⁿ − 2

n = host bits. Subtract network + broadcast.

Subnets = 2ⁿ

n = bits borrowed from host portion.

Block size = 256 − mask octet

a.k.a. the magic number. Subnet increment.

Network = IP AND mask

Bitwise AND to find the network address.

Broadcast = Network OR ~mask

OR with the wildcard mask.

Wildcard = 255.255.255.255 − mask

Inverse of subnet mask. Used in ACLs.

Powers of 2

2¹

2

2²

4

2³

8

2

16

2

32

2

64

2

128

2

256

2

512

2

1024

12IPv6 Quick Reference

128-bit address, 8 groups of 4 hex digits

2001:0db8:85a3:0000:0000:8a2e:0370:7334

Leading zeros dropped: 0db8 → db8

Consecutive zero groups: :: (once)

Short form: 2001:db8:85a3::8a2e:370:7334

Common Prefix Lengths

/128Host (loopback ::1)
/64Standard subnet
/48Site allocation
/32ISP allocation

IPv4 vs IPv6

32-bitvs128-bit4.3B addressesvs3.4×10³⁸NAT requiredvsEnd-to-endARPvsNDP

13Common Scenarios

Home / Office/24254 hosts, simple to manage
Router ↔ Router/302 usable IPs, no waste
Server VLAN/2730 hosts, limits blast radius
Loopback/321 host, always-up ID for OSPF/BGP
Cloud VPC/1665K IPs, split into /24 subnets
Guest WiFi/24Isolated, easy ACLs
Management/2814 hosts for switches/APs/iDRAC
DMZ/28Small, public-facing, tightly filtered

14Supernetting / Route Aggregation

Combine adjacent subnets into one larger prefix

Summarize 4 contiguous /24s

192.168.0.0/24 → ...00000000

192.168.1.0/24 → ...00000001

192.168.2.0/24 → ...00000010

192.168.3.0/24 → ...00000011

192.168.0.0/22— 22 common bits

Rule: can only summarize power-of-2 aligned contiguous blocks.

Smaller routing tables → faster convergence

Less protocol overhead → more stable network

The Complete Subnet Cheat Sheet

This subnet cheat sheet is a single-screen reference covering everything you need for subnetting — from CIDR notation and subnet masks to VLSM, wildcard masks, and IPv6 prefix lengths. Whether you are preparing for the CCNA, CompTIA Network+, or a technical interview, this guide has you covered.

Our subnetting cheat sheet includes the full CIDR-to-subnet-mask table with usable host counts, all three RFC 1918 private IP ranges, step-by-step subnet calculation examples, the magic number shortcut method, binary-to-decimal conversion, classful addressing reference, supernetting basics, and real-world subnet scenarios you will encounter on the job.

Unlike lengthy networking textbooks, this subnet mask cheat sheet is designed to fit your entire screen in one view — every mask, every CIDR prefix, every formula visible at a glance for quick review before your exam or interview.

Subnet Cheat Sheet FAQ

What is a subnet cheat sheet?expand_more

A subnet cheat sheet is a quick-reference guide that maps CIDR prefix lengths to subnet masks, usable host counts, wildcard masks, and block sizes. It helps network engineers, students, and IT professionals quickly look up subnetting values instead of calculating them from scratch every time.

What is a subnet mask and how does it work?expand_more

A subnet mask is a 32-bit number that divides an IP address into a network portion and a host portion. The mask uses consecutive 1-bits for the network part and 0-bits for the host part. For example, 255.255.255.0 (/24) means the first 24 bits identify the network and the last 8 bits identify hosts — giving you 254 usable addresses per subnet.

How do I calculate the number of usable hosts in a subnet?expand_more

Use the formula: usable hosts = 2^(host bits) − 2. You subtract 2 because the first address is the network address and the last is the broadcast address. For example, a /26 subnet has 6 host bits: 2^6 − 2 = 62 usable hosts. The exceptions are /31 (2 usable, RFC 3021 point-to-point) and /32 (single host route).

What is CIDR notation?expand_more

CIDR (Classless Inter-Domain Routing) notation represents an IP address followed by a slash and the number of network bits — for example, 192.168.1.0/24. The number after the slash tells you how many leading bits of the address are the network prefix. CIDR replaced the old classful addressing system (Class A/B/C) and allows more flexible subnet sizing.

What is the difference between a subnet mask and a wildcard mask?expand_more

A wildcard mask is the exact inverse of a subnet mask: wildcard = 255.255.255.255 − subnet mask. Where a subnet mask uses 1s to mark network bits and 0s for host bits, a wildcard mask uses 0s for 'must match' and 1s for 'don't care'. Wildcard masks are used in Cisco ACLs and OSPF configurations. For example, subnet mask 255.255.255.0 has wildcard mask 0.0.0.255.

What are the private IP address ranges?expand_more

RFC 1918 defines three private IP ranges that are not routable on the public internet: Class A: 10.0.0.0/8 (10.0.0.0 – 10.255.255.255, ~16.7 million hosts), Class B: 172.16.0.0/12 (172.16.0.0 – 172.31.255.255, ~1 million hosts), and Class C: 192.168.0.0/16 (192.168.0.0 – 192.168.255.255, ~65,000 hosts). These are used for internal networks behind NAT.

What is VLSM and why is it important?expand_more

VLSM (Variable Length Subnet Masking) lets you use different subnet mask sizes within the same network. Instead of giving every subnet the same size, you allocate larger subnets (e.g., /25) for segments with many hosts and smaller subnets (e.g., /30) for point-to-point links. This drastically reduces IP address waste compared to fixed-length subnetting.

How do I quickly find the network address for any IP?expand_more

Use the magic number method: (1) Find the 'interesting octet' — the subnet mask octet that isn't 255 or 0. (2) Calculate the block size: 256 − interesting octet value. (3) Find the largest multiple of the block size that is ≤ your IP's octet value. That gives you the network address. For example, 192.168.10.50/26: mask octet = 192, block = 64, 50 falls in the 0-block → network is 192.168.10.0.

Ready to ace your technical interview?

Practice with an AI interviewer that tests your networking knowledge, coding skills, and ability to think under pressure.

Try Crackr freearrow_forward

Continue learning