Lesson 2 of 4 · 6 min
CIDR notation explained
Turn a slash prefix into a subnet mask, address count, and usable host range.
By Calxo AI · Updated
That little slash is doing a lot of work
You’ve probably seen an address followed by /24 or /26. Good news: the slash number isn’t another formula to memorise. It simply counts how many bits belong to the network.
IPv4 has 32 bits. With /26, we use 26 for the network and have six left for hosts. The name for this notation is CIDR, short for Classless Inter-Domain Routing. For now, focus on the bit count rather than the long name.
Here’s the useful pattern: add one network bit and each block gets cut in half.
For a conventional IPv4 broadcast subnet.
One small distinction: 192.168.1.70/26 describes an address with its prefix. The block it belongs to is 192.168.1.64/26. Use the network address when naming the whole block, such as in an address plan or route.
Count the possibilities, then save two spots
Each host bit has two possibilities: 0 or 1. Two bits give four combinations; three give eight. Every extra host bit doubles the choices. With six host bits, that makes 2^6 = 64 addresses. The little ^ means “raised to the power of”.
/26 → 32 − 26 = 6 host bits Total addresses = 2^6 = 64 Conventional usable hosts = 64 − 2 = 62
Why subtract two? On an ordinary broadcast subnet, the first address names the network, and the last is its broadcast address. They already have jobs, so we leave them out of the host count. That turns 64 total addresses into 62 usable host addresses.
Prefixes you will use often
| Prefix | Subnet mask | Total addresses | 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 |
Use the table as a quick reference, not a memory test. If you forget a row, rebuild it: host bits = 32 − prefix, then total addresses = 2^(host bits). Subtract two for conventional usable hosts.
Which block does .70 call home?
Let’s place 192.168.1.70/26. Each /26 has 64 addresses. Inside this /24, the blocks start at 0, 64, 128, and 192. Since 70 lands between 64 and 127, it belongs to 192.168.1.64/26.
- Network address: 192.168.1.64.
- Last address: 64 + 64 − 1 = 127, giving broadcast address 192.168.1.127.
- First usable host: 192.168.1.65.
- Last usable host: 192.168.1.126.
Watch that final +64 − 1. We include the starting address when counting, so our block ends at .127. Address .128 is already the start of the next block. Off-by-one mistakes happen to everyone; checking the next boundary is a handy way to catch them.
Two exceptions worth keeping in your toolkit
The “subtract two” rule has limits. On a supported /31 point-to-point link, both addresses can be endpoints. RFC 3021 defines this arrangement without separate network and directed-broadcast reservations. Think of a link joining two endpoints, rather than an ordinary office LAN.
A /32 picks out one exact IPv4 address, often for a host route or loopback interface. There’s no sense subtracting two from one! At the opposite end, /0 covers all IPv4 address space and is used for a default route. That doesn’t mean every address in it can be assigned to a device.
Common mistakes
- Assuming the number after the slash is a host count.
- Forgetting that a longer prefix means fewer addresses.
- Applying the /24 last-octet shortcut to a prefix such as /20, whose boundary crosses an earlier octet.
- Using the conventional usable-host count as a guarantee from a cloud provider. Providers can reserve additional addresses.
Try it yourself
IPv4 subnet explorer
Change the address or prefix. Watch the network bits and host range update.
Blue = network bits (26). Amber = host bits (6).
- Network
- 192.168.1.64/26
- Subnet mask
- 255.255.255.192
- Total addresses
- 64
- Usable host addresses
- 62
- Host range
- 192.168.1.65 – 192.168.1.126
- Broadcast address
- 192.168.1.127
6 host bits → 2^6 = 64 addresses → 62 usable after the network and broadcast reservations. This is address arithmetic; special-use ranges and your network configuration may impose other restrictions.
Check your understanding
Choose an answer for every question, then check your work. You can retry as often as you like.
Sources and scope
These lessons explain IPv4 address arithmetic using IETF specifications. Host counts use conventional network and broadcast reservations, with /31 and /32 exceptions. Address availability also depends on special-use ranges, provider rules, and your configuration.
- RFC 791 — IPv4 address format
- RFC 4632 — CIDR prefixes and address blocks
- RFC 1918 — Private IPv4 address space
- RFC 3021 — /31 point-to-point links