🌐 Network & IP
Subnetting Cheat Sheet: CIDR, Masks & Host Counts
By Justin Le
· 5 min read · Updated June 27, 2026 Once you understand what a subnet is, what you mostly need day to day is a quick reference. Here's the subnetting cheat sheet — the CIDR-to-mask-to-hosts table plus the shortcuts that make it stick.
CIDR → mask → hosts (the table)
The most-used IPv4 prefixes, with their subnet mask, total addresses and usable hosts (total minus the network and broadcast addresses):
| CIDR | Subnet mask | Total | Usable hosts |
|---|---|---|---|
| /24 | 255.255.255.0 | 256 | 254 |
| /25 | 255.255.255.128 | 128 | 126 |
| /26 | 255.255.255.192 | 64 | 62 |
| /27 | 255.255.255.224 | 32 | 30 |
| /28 | 255.255.255.240 | 16 | 14 |
| /29 | 255.255.255.248 | 8 | 6 |
| /30 | 255.255.255.252 | 4 | 2 |
| /31 | 255.255.255.254 | 2 | 2* |
| /32 | 255.255.255.255 | 1 | 1* |
* /31 is used for point-to-point links (RFC 3021), where both addresses are usable; /32 describes a single host.
The powers-of-two trick
You don't need to memorise the table — just remember that the host count is a power of two.
The number of host bits is 32 − prefix, and the total addresses are
2^(32 − prefix):
- /24 → 2⁸ = 256
- /26 → 2⁶ = 64
- /28 → 2⁴ = 16
- /30 → 2² = 4
Subtract 2 for usable hosts (network + broadcast) on anything from /24 to /30. Each step up in prefix halves the size; each step down doubles it.
Mask octet values to recognise
The "interesting" octet of a subnet mask is always one of these values, which correspond to
how many bits are borrowed: 128, 192, 224, 240, 248, 252, 254, 255. Spotting
them tells you the prefix at a glance — a mask ending in .192 is a /26.
The boundary mistake
The classic error is the subnet boundary when the prefix isn't on an octet line. For a /26
(blocks of 64), valid networks are .0, .64, .128,
.192 — not .50 or .100. Always align the network
address to a multiple of the block size. When in doubt, check it with a calculator.
Private ranges to remember
10.0.0.0/8— a single huge private block.172.16.0.0/12— 172.16.x.x through 172.31.x.x.192.168.0.0/16— the home-network favourite.
Check your work
Confirm any subnet instantly with our subnet calculator — it shows the network, broadcast, host range and counts. To translate between CIDR blocks and plain ranges, use the CIDR ↔ IP range converter, and for IPv6 see the IPv6 subnet calculator.
Frequently asked questions
What is the subnet mask for a /26?
255.255.255.192. A /26 has 64 total addresses and 62 usable hosts, with valid network boundaries at .0, .64, .128 and .192.
How do I calculate the number of hosts in a subnet?
Total addresses are 2 to the power of the host bits (32 minus the prefix). Subtract 2 for usable hosts (the network and broadcast addresses). For example a /28 has 2^4 = 16 total and 14 usable.
What are the valid subnet mask octet values?
The interesting octet is always 128, 192, 224, 240, 248, 252, 254 or 255 — each corresponds to a number of borrowed bits, so a mask ending in .192 is a /26.
Try the related tools
- Subnet Calculator (IPv4 CIDR) Enter an IP and CIDR to instantly get the netmask, network, broadcast, host range and total number of addresses.
- CIDR ↔ IP Range Converter Expand a CIDR to its address range, or collapse an IP range into minimal CIDR blocks.
- IPv6 Subnet Calculator Get the network, address range, total count and compressed/expanded form of any IPv6 prefix.
Related guides
- What Is a Subnet? CIDR Notation Explained Subnets and CIDR notation explained in plain English — what /24 really means, how masks work, and how to divide a network without the headache.
- What Is an IP Address? What an IP address is and how it routes your traffic — public vs private, static vs dynamic, and why your phone and your router don't share the same one.
- IPv4 vs IPv6: What's the Difference? Why the internet is slowly moving from IPv4 to IPv6 — the address exhaustion problem, what actually changed, and how the two run side by side.