Subnetting cheat sheet: quick masks, host counts, ranges

Share
A printed subnet cheat sheet lies on a desk beside a calculator and pen.

A subnetting cheat sheet helps you convert CIDR prefixes to subnet masks, figure out how many usable hosts fit in a subnet, and identify the network address, broadcast address, and usable range without starting from scratch. This guide is built for that kind of quick lookup. If you know the prefix, you can get the mask and host count fast; if you know the subnet’s network address, you can find the broadcast address and usable IPs just as quickly.

What this cheat sheet helps you do in under a minute

Criteria

This is a quick reference, not a theory lesson. The entries were chosen because they cover the subnetting tasks people actually need at a desk, on a ticket, or during an exam.

Use this cheat sheet when you need to:

  • Convert /24 to 255.255.255.0, or the other way around.
  • Estimate how many usable hosts fit in a subnet.
  • Find the network address, broadcast address, and usable range.
  • Pick a prefix size that matches the number of devices you need.

If you already know the subnet’s block size, the rest is mostly pattern matching. For example, a /26 always gives the same number of addresses, the same number of usable hosts, and the same kind of range inside a /24 or larger block. The exact starting IP changes, but the rules do not.

CIDR prefixes and subnet masks at a glance

Entries

Here are the common IPv4 prefix lengths people use most often. The mask is the dotted-decimal version of the same value.

PrefixSubnet maskTotal addressesUsable hosts
/24255.255.255.0256254
/25255.255.255.128128126
/26255.255.255.1926462
/27255.255.255.2243230
/28255.255.255.2401614
/29255.255.255.24886
/30255.255.255.25242

A fast way to convert a prefix to a mask is to remember that each octet can only be one of these common values in subnetting work: 0, 128, 192, 224, 240, 248, 252, 254, 255.

The pattern comes from how many bits are set in the last non-255 octet. For example, /26 means 26 network bits total. That gives you 255.255.255.192, because the last octet has two network bits set: 11000000 in binary, which is 192 in decimal.

If you need the reverse, look for the non-255 octet and match it to the table:

  • 128 = /25
  • 192 = /26
  • 224 = /27
  • 240 = /28
  • 248 = /29
  • 252 = /30

How to choose

Use the prefix that matches the number of usable hosts you need. If you only need two usable IPs, /30 is the common fit. If you need a few dozen devices, /27 or /26 is usually the place to start. If you want a standard small LAN with room to grow, /24 is the reference point most people keep in mind.

How many usable hosts each subnet gives you

Use this rule:

usable hosts = 2^(host bits) - 2

The -2 matters because one address in every subnet is the network address and one is the broadcast address.

A few quick examples:

  • /24 has 8 host bits. 2^8 - 2 = 254 usable hosts.
  • /26 has 6 host bits. 2^6 - 2 = 62 usable hosts.
  • /30 has 2 host bits. 2^2 - 2 = 2 usable hosts.

You do not have to re-derive the exponent every time if you remember the common sizes from the table above. Still, the rule helps when you see less common prefixes.

For instance, /27 leaves 5 host bits, so 2^5 - 2 = 30 usable hosts. That is why /27 is a common choice for small office networks or segments that need a few dozen devices, while /30 is used for point-to-point links where only two usable IPs are needed.

One caution: the total number of addresses is not the same as the usable host count. A /29 has 8 total addresses, but only 6 usable ones.

How to spot the network, broadcast, and usable range

The fast method is to find the subnet block size, then count from the network address.

  1. Identify the mask or prefix.
  2. Find the block size in the changing octet.
  3. Locate the network address at the start of that block.
  4. The broadcast address is the last address in the block.
  5. The usable range starts one after the network address and ends one before the broadcast address.

For example, say you have 192.168.1.130/26.

A /26 has a block size of 64 in the last octet, so the subnets in that /24 go 0-63, 64-127, 128-191, and 192-255. Since 130 falls in the 128-191 block:

  • Network address: 192.168.1.128
  • Broadcast address: 192.168.1.191
  • Usable range: 192.168.1.129 to 192.168.1.190

Another example: 10.0.5.14/30.

A /30 has a block size of 4, so the ranges go 0-3, 4-7, 8-11, 12-15, and so on. 14 falls in 12-15:

  • Network address: 10.0.5.12
  • Broadcast address: 10.0.5.15
  • Usable range: 10.0.5.13 to 10.0.5.14

If the last octet is not the changing octet, apply the same idea to the first octet that is not 255 in the mask.

Which subnet size should you pick for this network?

Pick the smallest subnet that still fits your device count, then leave a little room if the network may grow. If you make the subnet too small, you run out of addresses. If you make it too large, you waste space and make the segment broader than it needs to be.

A quick way to choose:

  • Use /30 for point-to-point links when you need exactly two usable IPs.
  • Use /27 when you need up to 30 usable hosts.
  • Use /26 when you need up to 62 usable hosts.
  • Use /25 when you need up to 126 usable hosts.
  • Use /24 for a standard small LAN with up to 254 usable hosts.

If you are sizing a new network, count devices that actually need IP addresses, not just physical endpoints. That usually includes routers, switches with management IPs, printers, APs, servers, phones, and sometimes guest devices. It does not always include every cable or port.

A common pattern is to reserve a little space for growth rather than choosing the exact current number. For example, if you need 20 devices today, a /27 is usually a better fit than a /28, because a /28 only gives 14 usable hosts. If you need 50, a /26 fits better than a /27.

The subnetting mistakes that trip people up

A few errors come up again and again.

  • Mixing up total addresses with usable hosts. A /30 has 4 total addresses, but only 2 usable ones.
  • Forgetting that the all-zeros address in a subnet is the network address and the all-ones address is the broadcast address.
  • Assuming every subnet in a larger network has the same starting point. The range changes in fixed blocks.
  • Using the wrong octet for the block size. Only the octet where the mask stops being 255 changes.
  • Treating /31 like a normal host subnet. It is a special case in many environments and is not the same as the common sizes in this cheat sheet.
  • Counting only end devices and forgetting infrastructure IPs like gateways, management interfaces, and printers.

If you remember one habit, make it this: always check both the block size and the reserved addresses before you assign IPs. That prevents most of the mistakes people make under time pressure.

Conclusion

If you need to work fast, start with the prefix table, then use the host formula only when the size is unfamiliar. After that, find the block size, locate the network address, and the broadcast plus usable range fall into place. If you want, you can keep the `/24` through `/30` rows handy and use them as your default reference for most day-to-day subnetting work.

Frequently Asked Questions

Why does every subnet lose two addresses?

Because one address is reserved for the network itself and one is reserved for the broadcast address. That leaves the usable host count as `2^(host bits) - 2` for normal IPv4 subnets.

How do I convert a subnet mask back to CIDR quickly?

Count the `1` bits in the mask. For common masks, you can also match the non-255 octet to the lookup table: `128` is `/25`, `192` is `/26`, `224` is `/27`, `240` is `/28`, `248` is `/29`, and `252` is `/30`.

What subnet should I use for two devices?

A `/30` is the common choice because it gives you 2 usable host addresses. That fits a point-to-point link or a small routed connection.

Does every subnet always have the same usable host count?

No. The usable host count depends on the prefix length. A `/24` has 254 usable hosts, a `/26` has 62, and a `/30` has 2.