CCNA 200-301

CCNP Enterprise

CCNP Security

CCIE Enterprise Lab

CCIE Security Lab

CCNP Service Provider

CCNP Data Center

CCNP Collaboration

CCIE DC Lab

Subnet masks are one of those things almost everyone in networking has to look up at some point, no matter how many times they’ve calculated one before — the difference between a /27 and a /28, or what wildcard mask corresponds to 255.255.255.192, just isn’t something most people carry around in working memory. This article explains how to actually read and calculate the values in a subnet mask table, gives you a complete printable-style cheat sheet including wildcard masks, compares how IPv4’s dotted-decimal masks relate to IPv6’s prefix lengths, points you to a calculator for quick real-world lookups, and covers the mental math shortcuts that make subnetting questions fast on exams like CCNA and Network+.

How to Read and Calculate a Subnet Mask Table

Before using a cheat sheet effectively, it helps to understand what each column actually represents and how the values are derived, rather than just memorizing them outright.

  1. A subnet mask marks which bits belong to the network vs. the host. In a 32-bit IPv4 address, the subnet mask uses binary 1s to mark “network” bits and 0s to mark “host” bits — 255.255.255.0 in binary is 11111111.11111111.11111111.00000000, meaning the first 24 bits are network bits and the last 8 are host bits.
  2. CIDR notation is just a shorthand count of those network bits. Rather than writing out the full dotted-decimal mask, CIDR notation simply states how many bits are set to 1255.255.255.0 and /24 describe the exact same mask, just in two different formats.
  3. Total addresses and usable hosts follow directly from the host bits. With h host bits remaining, the subnet contains 2^h total addresses. Two of those — the network address (all host bits set to 0) and the broadcast address (all host bits set to 1) — are reserved rather than assignable to a device, so usable hosts is 2^h minus 2 for any subnet larger than a /31.
  4. A wildcard mask is the inverse of a subnet mask. Used primarily in Cisco ACL and OSPF configuration, a wildcard mask flips every bit of the subnet mask — where the subnet mask has a 1, the wildcard mask has a 0, and vice versa. In practice, this means subtracting each octet of the subnet mask from 255: a 255.255.255.0 subnet mask becomes a 0.0.0.255 wildcard mask.
  5. The pattern repeats predictably across every prefix length. Each additional network bit (moving from /24 to /25, for instance) cuts the number of host bits by one, which halves both the total address count and the usable host count — this consistent doubling/halving pattern is what makes the full cheat sheet below easy to sanity-check even if you forget one specific row.

With that logic in place, here’s the complete reference table applying it across every commonly used prefix length.

Full Subnet Mask Cheat Sheet: CIDR, Decimal Mask, Wildcard Mask, and Hosts

CIDR   Subnet Mask         Wildcard Mask        Total Addresses   Usable Hosts
/8     255.0.0.0           0.255.255.255        16,777,216        16,777,214
/16    255.255.0.0         0.0.255.255          65,536            65,534
/17    255.255.128.0       0.0.127.255          32,768            32,766
/18    255.255.192.0       0.0.63.255           16,384            16,382
/19    255.255.224.0       0.0.31.255           8,192             8,190
/20    255.255.240.0       0.0.15.255           4,096             4,094
/21    255.255.248.0       0.0.7.255            2,048             2,046
/22    255.255.252.0       0.0.3.255            1,024             1,022
/23    255.255.254.0       0.0.1.255            512               510
/24    255.255.255.0       0.0.0.255            256               254
/25    255.255.255.128     0.0.0.127            128               126
/26    255.255.255.192     0.0.0.63             64                62
/27    255.255.255.224     0.0.0.31             32                30
/28    255.255.255.240     0.0.0.15             16                14
/29    255.255.255.248     0.0.0.7              8                 6
/30    255.255.255.252     0.0.0.3              4                 2
/31    255.255.255.254     0.0.0.1              2                 0 (point-to-point link)
/32    255.255.255.255     0.0.0.0              1                 1 (single host route)

This table covers the prefix range used in the overwhelming majority of real-world subnetting — from large enterprise blocks down to individual point-to-point links — with the wildcard mask column included specifically for anyone working with Cisco access control lists or OSPF network statements, where the wildcard format is required rather than the standard subnet mask.

IPv4 Subnet Masks vs. IPv6 Prefix Lengths

The same underlying concept — marking how many bits belong to the network — applies to IPv6, but the format and typical values look quite different given how much larger IPv6 addresses are.

FactorIPv4 Subnet MaskIPv6 Prefix Length
Address length32 bits128 bits
Notation formatDotted-decimal (e.g., 255.255.255.0) or CIDR (/24)CIDR-only (e.g., /64) — dotted-decimal-style notation isn’t used
Maximum prefix/32/128
Typical ISP customer allocationA single public address, or a small block/48 or /56
Standard subnet sizeVaries widely by need (see cheat sheet above)/64 is the near-universal standard for individual subnets
Wildcard mask equivalent used in configurationYes — common in Cisco ACLs and OSPF, as shown aboveNo standard wildcard mask equivalent in typical IPv6 configuration syntax
Broadcast address conceptYes — reserved last address in each subnetNo — IPv6 has no broadcast address; multicast serves equivalent functions

Why the difference in approach? IPv4’s address scarcity is what drove the detailed, closely-managed subnetting shown in the cheat sheet above — every bit matters when the total pool is only 4.3 billion addresses. IPv6’s address space is so large that standardizing almost every subnet at /64 (leaving 64 bits for host addressing alone) avoids the need for the same granular, size-conscious calculations IPv4 requires.

Using an Online Subnet Mask Calculator

While the tables above cover the standard values, a calculator is often faster and less error-prone when working with a specific, real IP address rather than just a general reference.

What does a subnet mask calculator actually compute? Enter an IP address along with either a subnet mask or a CIDR prefix, and the tool returns the network address, broadcast address, first and last usable host addresses, and total/usable host counts — all derived from the same logic covered in the “how to read a subnet mask table” section above, just applied instantly to your specific input.

Can a calculator convert an IP range directly into the correct subnet mask? Yes — most subnet calculators also support entering a starting and ending IP address and returning the smallest subnet mask (or CIDR prefix) that fully covers that range, which is useful when you know a network’s boundaries but need to determine or confirm the correct mask for it.

Do these tools also generate wildcard masks? Many do, particularly those aimed at Cisco networking audiences — since wildcard masks (covered earlier) are needed specifically for ACL and OSPF configuration, a calculator that outputs both the standard subnet mask and its wildcard equivalent side by side saves a manual conversion step.

When is the cheat sheet faster than a calculator? For standard, commonly used values you’re already partially familiar with, glancing at the cheat sheet is typically faster than opening a tool. A calculator becomes more valuable specifically when working with a real, non-round IP address and needing exact network boundaries rather than the general pattern.

Having both the reference table and a calculator on hand covers the vast majority of real-world subnetting needs — but if you’re preparing for a certification exam, there’s a faster method than looking anything up at all, covered next.

Subnetting Shortcuts for CCNA and Network+ Exams

Certification exams like CCNA and Network+ are timed, which means recalculating subnet values from scratch for every question wastes precious minutes — these mental math shortcuts are built specifically to get you to the answer faster.

  1. Memorize the “magic number” (block size) pattern instead of the full mask. The magic number is simply 256 minus the interesting octet’s mask value — for a 255.255.255.192 mask (/26), the magic number is 256 - 192 = 64. This number tells you the size of each subnet block and lets you count subnet boundaries quickly (0, 64, 128, 192) without needing to convert to binary at all.
  2. Learn the CIDR-to-magic-number pairs for the most commonly tested masks. For the last octet: /25 = 128, /26 = 64, /27 = 32, /28 = 16, /29 = 8, /30 = 4 — these six values cover the vast majority of subnetting questions on both CCNA and Network+ exams, and are worth memorizing outright rather than recalculating each time.
  3. Use the magic number to instantly find network and broadcast addresses. Once you know the magic number, the network address for any given host is the largest multiple of that number that’s less than or equal to the host’s address, and the broadcast address is one less than the next multiple — for a host at 192.168.1.150 with a /26 mask (magic number 64), the subnet boundaries are 128 and 192, making the network address 192.168.1.128 and the broadcast address 192.168.1.191.
  4. Practice counting in binary powers of two until it’s automatic. Since usable hosts always follow the 2^h – 2 pattern (covered in the “how to read” section above), being able to instantly recall that 2^6 = 64 or 2^4 = 16 without pausing to calculate saves meaningful time across a full subnetting-heavy exam section.
  5. For questions asking “how many subnets,” focus on the borrowed bits, not the whole mask. If a question gives you a default Class C mask and asks how many subnets result from borrowing 3 bits, the answer is simply 2³ = 8 — you don’t need to work out the full resulting subnet mask unless the question specifically asks for it.
  6. Write out the reference cheat sheet from memory before the exam starts, if allowed. Many candidates use permitted scratch space at the start of a timed exam to quickly jot down the CIDR-to-magic-number table from step 2 above, effectively recreating a condensed version of the cheat sheet in this article so it’s available for quick reference throughout the rest of the test.
  7. Time yourself practicing with random IP/mask combinations. Since exam subnetting questions are usually more about speed than difficulty, repeated practice converting random addresses using the magic number method until it takes just a few seconds per question is the most reliable way to build real exam-day speed.

The magic number method above is really just a faster mental shortcut for the exact same host-and-network-bit logic explained at the start of this article — understanding why it works, rather than memorizing it as an isolated trick, is what makes it reliable under exam pressure rather than something you second-guess when a question phrases things slightly differently than expected.

Between understanding the underlying bit math, having the full mask-and-wildcard reference table on hand, knowing how IPv6 changes the picture, using a calculator for real-world addresses, and mastering the magic number shortcut for exam speed, this cheat sheet and the reasoning behind it should cover essentially every subnet mask question you’re likely to run into, whether you’re configuring a live network or sitting a certification exam.

Please follow and like us:
Last modified: September 7, 2026

Author

Comments

Write a Reply or Comment

Your email address will not be published.