CIDR and IPv4 subnets, explained with examples
CIDR is a compact way to say which part of an IP address identifies a network. Once you understand the prefix length, you can work out the block size, address range and—usually—the number of assignable host addresses.
What does /26 mean?
An IPv4 address has 32 bits. In 192.0.2.130/26, the /26 prefix says that the first 26 bits are the network prefix; the remaining six bits are available to distinguish addresses inside that block. A subnet mask writes those prefix bits in dotted-decimal form: /26 is 255.255.255.192.
The prefix is more precise than old class-based assumptions: the boundary can fall at any bit, not only between dotted octets. RFC 4632 describes CIDR as a classless address allocation and route-aggregation approach.
Worked example: 192.0.2.130/26
- The first three mask octets are
255; the last is192. The final octet therefore has a block size of256 − 192 = 64. - Blocks in that octet start at 0, 64, 128 and 192. The address
.130falls in the block starting at.128. - That block ends at
.191. So the network address is192.0.2.128, and the last address is192.0.2.191. - For a conventional IPv4 subnet, the first and last addresses are the network and directed-broadcast addresses. The remaining
2⁶ − 2 = 62addresses are typically assignable to hosts.
Network: 192.0.2.128
First host: 192.0.2.129
Last host: 192.0.2.190
Broadcast: 192.0.2.191
Mask: 255.255.255.192
Host bits: 6
The addresses in this example are from the documentation range 192.0.2.0/24; they are examples, not public hosts to configure in a live network.
Why the “minus two” rule has exceptions
The familiar formula 2^(32 − prefix) − 2 is a useful estimate for conventional IPv4 subnets, not a universal rule for every prefix. RFC 3021 allows a /31 on a point-to-point link to use both addresses as endpoints, instead of treating them as network and broadcast addresses. A /32 contains exactly one IPv4 address and is commonly used to identify a single host or route.
IPv6 uses prefix lengths too, but it does not use IPv4-style broadcast addresses. Do not apply the IPv4 “minus two” host-count rule to IPv6.
Quick mental model
- A larger prefix number leaves fewer host bits and creates a smaller block:
/27is smaller than/24. - Each bit added to the prefix halves the block; each bit removed doubles it.
- For prefixes not aligned on an octet boundary, find the interesting mask octet and count block-size increments.
- Check allocation and routing policy before using a calculated range; arithmetic alone cannot tell you whether an address is available or appropriate.
192.0.2.130/26 in the Subnet & CIDR Calculator to compare the worked result. Use the Network Planner when you need to compare multiple address blocks.