How To

Subnetting Cheat Sheet: IPv4 Masks, Hosts, and VLSM

Every IPv4 subnet mask, the usable host count it gives you, the wildcard mask, and the fastest way to work a subnet by hand. This subnetting cheat sheet is one page you can scan, print, and pin above the desk, no calculator needed.

Original content from computingforgeeks.com - post 168988

It covers the CIDR to subnet mask table, hosts per subnet, the magic-number method, wildcard (inverse) masks, address class ranges, and the VLSM rules. It is the quick-reference companion to the CCNA 200-301 study path; for the worked method behind each number, jump to the full guides linked below.

Current as of October 2026, aligned to the CCNA 200-301 exam blueprint.

Subnetting cheat sheet: the subnet mask table

This is the table you reach for most. It subnets a /24 down to a /30, the range CCNA tests hardest. Block size is the gap between subnet IDs in the last octet, which is also the count of addresses in each subnet.

CIDRSubnet maskWildcardUsable hostsBlock size
/24255.255.255.00.0.0.255254256
/25255.255.255.1280.0.0.127126128
/26255.255.255.1920.0.0.636264
/27255.255.255.2240.0.0.313032
/28255.255.255.2400.0.0.151416
/29255.255.255.2480.0.0.768
/30255.255.255.2520.0.0.324
/31255.255.255.2540.0.0.12 (point-to-point, RFC 3021)2
/32255.255.255.2550.0.0.01 (host route)1

For bigger blocks, the same pattern walks up the octets. Usable hosts is always 2 raised to the host bits, minus 2 for the network and broadcast addresses.

CIDRSubnet maskUsable hosts
/8255.0.0.016,777,214
/16255.255.0.065,534
/19255.255.224.08,190
/20255.255.240.04,094
/21255.255.248.02,046
/22255.255.252.01,022
/23255.255.254.0510

Hosts needed to subnet mask

Sizing a subnet from a host count is the core CCNA skill. Pick the smallest mask where usable hosts is at least what the segment needs. Borrow the fewest host bits that still fit, so the rest of the address space stays free.

Hosts neededHost bitsMaskUsable hosts
22/302
up to 63/296
up to 144/2814
up to 305/2730
up to 626/2662
up to 1267/25126
up to 2548/24254
up to 5109/23510
up to 102210/221022

The magic-number method

The magic number is the block size in the interesting octet, and it equals 256 minus the mask value in that octet. Subnets start at multiples of it. Memorize this column and you can subnet in your head.

Mask octetBorrowed bitsMagic number (block)
1281128
192264
224332
240416
24858
25264
25472

Wildcard (inverse) masks

ACLs and OSPF network statements take a wildcard mask, not a subnet mask. The wildcard is the inverse: subtract each subnet-mask octet from 255.

CIDRSubnet maskWildcard mask
/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
/16255.255.0.00.0.255.255

Address classes and private ranges

Classful boundaries still drive default masks and the private ranges from RFC 1918. The first octet of the address decides the class.

ClassFirst octetDefault maskPrivate range (RFC 1918)
A1 to 126/810.0.0.0/8
B128 to 191/16172.16.0.0/12
C192 to 223/24192.168.0.0/16
D (multicast)224 to 239n/an/a
E (reserved)240 to 255n/an/a

Worth keeping nearby: 127.0.0.0/8 is loopback, and 169.254.0.0/16 is the link-local (APIPA) range a host self-assigns when DHCP fails.

VLSM rules

Variable-length subnet masking sizes each subnet to its own host count instead of forcing one mask everywhere. Six rules cover it.

RuleWhat it does
Pick the maskSmallest mask where usable hosts is at least the count needed
Allocate largest firstBiggest subnet, then down to the /30 links
Start after the last broadcastNext subnet ID is the previous broadcast plus 1
Overlap checkNext subnet ID must be above the previous broadcast
Protocol supportRIPv2, OSPFv2, EIGRP carry the mask; RIPv1 does not
Verify in IOS“variably subnetted” in show ip route confirms it

How to use this subnetting cheat sheet

How do you find the network and broadcast address?

AND the IP with the mask to get the network address. The broadcast is the network plus the block size minus 1. Take 192.168.1.50/27: the /27 block is 32, so the network rounds down to 192.168.1.32, the broadcast is 192.168.1.63, and the usable range is 192.168.1.33 to 192.168.1.62. The full method, AND operation and all, is in the step-by-step subnetting guide.

How do you pick a subnet mask from a host count?

Find the smallest mask whose usable hosts is at least what the segment needs. A 26-user LAN needs at least 30 usable, so /27 fits and /28 (14) does not. Work the same logic per segment when you subnet by network requirements.

What is the fastest way to subnet by hand?

Use the magic number. Subtract the interesting mask octet from 256 to get the block, then count up in blocks until you pass the address you care about. The subnet ID is the multiple just below it. No binary, no calculator.

When do you need VLSM?

Whenever segments differ in size and you want zero wasted addresses, give each its own mask. Size them, allocate the largest first, and pack them with no gaps. The full worked design is in VLSM subnetting explained. To put those subnets on a Linux interface, the ip command cheat sheet shows ip addr and ip route with real output.

Practice subnetting

A cheat sheet gets you the numbers; drilling makes them automatic. The trainer generates an endless stream of network, broadcast, and host-range questions with instant checking.

Loading subnetting trainer...

Flip through the core facts until the masks, host counts, and block sizes are instant recall. Mark each card you know, then grab the Anki deck to keep reviewing on your phone.

Loading flashcards...

Then test the decisions the tables encode: mask choice, block size, and the VLSM judgement calls, each answer worked out.

Free practice

CCNA practice: Domain 1: Network Infrastructure and Connectivity

10 questions drawn fresh from 152 in the bank, with the answer and explanation after each one.

Start 10 questions

Pin the PDF where you can see it, run the trainer until you stop reaching for the tables, and subnetting stops being the part of the exam you dread.

Keep reading

Free CCNA Practice Test: 600+ Questions for 200-301 v2.0 Networking Free CCNA Practice Test: 600+ Questions for 200-301 v2.0 Install Samba on Debian 13 / 12 and Create a File Share Debian Install Samba on Debian 13 / 12 and Create a File Share Configure Samba File Sharing on Linux Mint 22 Networking Configure Samba File Sharing on Linux Mint 22 Agentic AI in Network Operations: Tested on Cisco IOS Networking Agentic AI in Network Operations: Tested on Cisco IOS Cisco Switch Port Configuration for Phones, APs and Servers Networking Cisco Switch Port Configuration for Phones, APs and Servers Homelab Deals December 2026: Gifts and Year-End Upgrades Networking Homelab Deals December 2026: Gifts and Year-End Upgrades

Leave a Comment

Press ESC to close