Subnetting · 4 min read

The subnet cheat sheet: prefix, mask and host counts

Subnetting is fundamental to network design and troubleshooting, but converting between dotted-decimal subnet masks, CIDR prefixes, and host counts requires accuracy under pressure. Whether you are designing a network, validating a configuration, or sitting for a certification exam, having a reliable reference eliminates mental math errors and speeds up your workflow.

Understanding CIDR and subnet masks

CIDR (Classless Inter-Domain Routing) notation expresses a network address and prefix length as a single value: for example, 192.168.1.0/24. The number after the slash is the prefix length--the count of network bits. The subnet mask in dotted-decimal form represents the same boundary: /24 equals 255.255.255.0.

Each bit position in a subnet mask corresponds to one bit in the 32-bit IPv4 address. The network portion is all 1s; the host portion is all 0s. A /24 prefix means 24 network bits and 8 host bits. Those 8 host bits can represent 2^8 = 256 total addresses, but only 254 are usable for hosts (the network address and broadcast address are reserved).

Quick conversion reference

Common subnet masks and their CIDR equivalents:

CIDR  Subnet Mask       Host Bits  Total Addresses  Usable Hosts
/30   255.255.255.252  2          4                2
/29   255.255.255.248  3          8                6
/28   255.255.255.240  4          16               14
/27   255.255.255.224  5          32               30
/26   255.255.255.192  6          64               62
/25   255.255.255.128  7          128              126
/24   255.255.255.0    8          256              254
/23   255.255.254.0    9          512              510
/22   255.255.252.0    10         1024             1022
/21   255.255.248.0    11         2048             2046
/20   255.255.240.0    12         4096             4094
/19   255.255.224.0    13         8192             8190
/18   255.255.192.0    14         16384            16382
/17   255.255.128.0    15         32768            32766
/16   255.255.0.0      16         65536            65534

Calculating host counts and usable addresses

The formula is straightforward. If a subnet has h host bits, then:

For a /25 subnet: 7 host bits, so 2^7 = 128 total addresses, and 128 - 2 = 126 usable hosts. For a /30 subnet (point-to-point links): 2 host bits, so 2^2 = 4 total addresses, and 4 - 2 = 2 usable hosts.

Practical application in design and troubleshooting

When designing a network, you must match the prefix length to your requirements. A department with 50 devices needs at least 52 addresses (50 hosts plus network and broadcast). A /26 provides 62 usable hosts and is the right fit. A /25 wastes addresses; a /27 (30 usable hosts) is too small.

During troubleshooting, quickly verifying that an assigned address belongs to the correct subnet requires converting the prefix to a mask, then checking the network boundary. If a device has IP 10.0.5.130 with mask 255.255.255.128 (/25), you can confirm it belongs to network 10.0.5.128 with broadcast 10.0.5.255.

Certification candidates must internalize these conversions. Exam questions often test your ability to identify valid host ranges, calculate required prefix lengths, or spot overlapping subnets. Speed and accuracy matter.

Subnet Cheat Sheet
Free, interactive reference for CIDR, masks, and host counts
Open →
Practise this on today’s Daily Ops Drill — a free network task every day.
Open the app →
Free tools for this
More from the blog
Subnetting on the Fortinet NSE4 exam: what to expectRead →Auditing an ACL for the permit any that should not be thereRead →