Skip to content

Subnet Cheat Sheet: CIDR /16 to /32 Quick Reference

Mike WaltonUpdated 6 min read

You’re on a call, someone asks how many hosts fit in a /27, and your brain returns a blank page. It happens to everyone. This subnet cheat sheet is the page to bookmark: every IPv4 prefix from /16 to /32 with its subnet mask, wildcard mask, total addresses, and usable hosts, plus a few tricks for doing the math in your head when you can’t look it up.

If you want the deep dive on the most common network size, start with our guide to what a /24 subnet is and how 255.255.255.0 works. This post is the quick reference.

The Subnet Cheat Sheet

CIDR Subnet Mask Wildcard Mask Total Addresses Usable Hosts
/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 2 (point-to-point only)
/32 255.255.255.255 0.0.0.0 1 1 (single host)

Usable hosts is total addresses minus two: the first address is the network ID and the last is the broadcast address. The two exceptions are at the bottom of the chart, and we’ll get to them.

How to Read a CIDR Prefix

The number after the slash is how many bits, out of 32, belong to the network. Everything left over belongs to hosts. A /24 has 24 network bits and 8 host bits, and 2^8 is 256 addresses. A /27 has 5 host bits, and 2^5 is 32.

That’s the whole trick. Every time the prefix grows by one, the subnet is cut in half. Every time it shrinks by one, the subnet doubles. Once that clicks, you can rebuild most of the chart from memory:

  • /24 = 256
  • /25 = 128
  • /26 = 64
  • /27 = 32
  • /28 = 16

The wildcard mask is just the subnet mask flipped (255 minus each octet). You’ll see it in Cisco ACLs and OSPF network statements, which is the main reason it’s in the chart.

Finding Subnet Boundaries Fast

The block size tells you where each subnet starts. For anything smaller than a /24, the block size is the total address count from the chart, and subnets start at multiples of it in the last octet.

Split 192.168.10.0/24 into /26 subnets and you get blocks of 64:

Subnet Network First Host Last Host Broadcast
192.168.10.0/26 .0 .1 .62 .63
192.168.10.64/26 .64 .65 .126 .127
192.168.10.128/26 .128 .129 .190 .191
192.168.10.192/26 .192 .193 .254 .255

So which subnet is 192.168.10.150/26 in? 150 falls between 128 and 191, so it’s in 192.168.10.128/26. No binary required.

The same idea works for prefixes larger than a /24, just one octet over. A /22 is four /24s stacked together, so it starts on a third octet that’s a multiple of 4. 10.20.0.0/22 runs from 10.20.0.0 to 10.20.3.255. Try to build 10.20.2.0/22 and you’ve made a mistake, because 2 isn’t a multiple of 4.

Here’s how many /24s fit in each larger block:

CIDR Number of /24s
/23 2
/22 4
/21 8
/20 16
/19 32
/18 64
/17 128
/16 256

The Odd Ones: /31 and /32

A /30 used to be the standard for router-to-router links: four addresses, two usable. That wastes half the block on a link that will only ever have two devices.

RFC 3021 fixed that by allowing /31 prefixes on point-to-point links. With a /31, both addresses are treated as host addresses, so there’s no network ID or broadcast to give up. Most modern routing gear supports it, but check your platform before you roll it out across the WAN.

A /32 is a single address. You’ll see it on loopback interfaces, host routes, and firewall rules that target exactly one machine.

Which Size Should You Use?

The chart tells you what fits. It doesn’t tell you what you should pick. A few rules of thumb from real networks:

  • User VLANs: a /24 is the comfortable default. If a floor or site is pushing 200 devices, jump to a /23 now rather than renumbering later.
  • Servers, printers, and cameras: a /26 or /27 per function keeps things tidy and makes firewall rules easier to read.
  • Management networks: a /27 or /28 is usually plenty for switches, APs, and iDRAC/iLO ports.
  • Point-to-point links: /31 where supported, /30 where it isn’t.
  • Whole sites: carve a /20 or /16 per site out of the RFC 1918 private ranges (10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16) so every site summarizes cleanly.

Leave room to grow. The most common subnetting regret isn’t picking the wrong mask, it’s packing subnets so tightly that the next expansion forces a renumber on a Saturday. Our post on subnet planning best practices goes deeper on building a plan that ages well, and mapping subnets to VLANs covers keeping the two in sync.

Checking Your Math from the Command Line

If you’d rather not trust your head at 2 a.m., Python ships with everything you need:

python3 -c "import ipaddress; n=ipaddress.ip_network('192.168.10.96/27'); print(n.network_address, n.broadcast_address, n.netmask, n.num_addresses)"

Output:

192.168.10.96 192.168.10.127 255.255.255.224 32

Usable hosts in that /27 run from .97 to .126.

Quick FAQ

How many hosts are in a /27? 30 usable out of 32 total.

What subnet mask is /23? 255.255.254.0, with 510 usable hosts.

What’s the difference between a subnet mask and a wildcard mask? They’re inverses. The subnet mask marks network bits with 1s, and the wildcard mask marks host bits with 1s.

Is CIDR the same as Class C? No. Classes were retired in favor of CIDR in the 1990s. RFC 4632 is the current reference. A /24 happens to match the old Class C size, which is why the two get mixed up.

Do the Math Once, Then Track It

A cheat sheet gets the subnet right. Keeping track of which subnets exist, which IPs are taken, and who’s using them is the part that slowly falls apart in a spreadsheet.

Subnet24 has free subnet calculators for IPv4 and IPv6 at subnet24.com. When you’re ready to stop recalculating the same networks, a free Subnet24 account gives you 4 subnets, free forever, with every IP generated and ready to assign. No credit card required.

References

Related posts

Stop losing track of your IP addresses

Subnet24 automates IP address management with real-time scanning, conflict prevention, and team collaboration.

Get Your Free Account!

4 Subnets free forever | No credit card required