Subnet Cheat Sheet
1Subnet Reference, 4th Octet (/24, /32)
*Subnets within a /24. Usable = 2ⁿ−2 (except /31 P2P and /32 host).
2Subnet Reference, 3rd Octet (/16, /23)
Block = number of /24-sized blocks in this subnet.
Class-scale Prefixes
3How Subnetting Works
The subnet mask splits the IP into two parts
192.168.1.100 / 26
Result: Everything you need
4Subnet Splitting, Visual
A /24 can be split into smaller equal subnets
5The Magic Number, Fastest Method
Find any network/broadcast/range in 3 steps
Find the interesting octet
The mask octet that's not 255 or 0
Magic number = 256 − mask value
This is your block size (subnet increment)
Subnets start at multiples of magic number
Find which block your IP falls in
Example: 172.16.45.200 /26
6Private Ranges (RFC 1918)
16,777,214 usable hosts
1,048,574 usable hosts
65,534 usable hosts
Other Reserved
7Wildcard Masks
Wildcard = 255.255.255.255 − subnet mask
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.
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
Steps
- 1. Sort subnets largest-need first
- 2. Pick smallest CIDR that fits each
- 3. Allocate sequentially, never overlap
10Classful Addressing (Legacy)
Replaced by CIDR, but still referenced in exams
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
IPv4 vs IPv6
13Common Scenarios
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
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_forwardContinue learning
System Design Cheat Sheet
Load balancing, caching, databases, and more
Big O Cheat Sheet
Time & space complexity reference
Blind 75
The original 75 LeetCode problems
DSA Tracker
177 problems across 16 DSA topics
Grind 75
Updated plan with custom time targets
Algorithm Visualizers
See DSA in action
Company Questions
Real interview questions by company