· 5 min read
CIDR notation and subnetting explained
A slash and a number after an address, like /24, is all of subnetting in one symbol. It says how many of the address's bits name the network. This guide reads it, works two examples by hand, and shows where a calculator saves time.
On this page
What the slash means#
CIDR notation writes an address, a slash and a number: 192.168.10.0/26. The number is the prefix length: how many of the address's bits, counting from the left, identify the network. The rest identify a host inside it. An IPv4 address has 32 bits, so a /26 leaves 32 − 26 = 6 bits for hosts, and 2^6 = 64 addresses in the block.
A prefix length is just another way to write a subnet mask. A /26 means 26 one-bits followed by 6 zero-bits, which in dotted decimal is 255.255.255.192. The two notations carry the same information. CIDR is shorter, and it is what routers, cloud consoles and firewall rules use. The idea replaced the old address classes in 1993 (RFC 4632).
Common prefix lengths#
| Prefix | Subnet mask | Addresses | Usable hosts | Typical use |
|---|---|---|---|---|
/8 | 255.0.0.0 | 16,777,216 | 16,777,214 | The largest private block, 10.0.0.0/8 |
/16 | 255.255.0.0 | 65,536 | 65,534 | A large site or the home range 192.168.0.0/16 |
/20 | 255.255.240.0 | 4,096 | 4,094 | A campus or a cloud virtual network |
/22 | 255.255.252.0 | 1,024 | 1,022 | A medium site |
/24 | 255.255.255.0 | 256 | 254 | An ordinary local network |
/25 | 255.255.255.128 | 128 | 126 | Half a /24 |
/26 | 255.255.255.192 | 64 | 62 | A department, a floor, a guest network |
/27 | 255.255.255.224 | 32 | 30 | A small office |
/28 | 255.255.255.240 | 16 | 14 | A server segment |
/29 | 255.255.255.248 | 8 | 6 | A handful of servers or a small business line |
/30 | 255.255.255.252 | 4 | 2 | A point-to-point link, the classic size |
/31 | 255.255.255.254 | 2 | 2 (point-to-point only) | A point-to-point link, using both addresses (RFC 3021) |
/32 | 255.255.255.255 | 1 | 1 | A single host, or one route to one address |
Usable hosts are the addresses less two: the first (the network address) and the last (the broadcast address) cannot be given to a device. /31 and /32 are the exceptions.
Two examples worked by hand#
Example 1: how big is 192.168.10.0/26?
- Host bits:
32 − 26 = 6. - Addresses:
2^6 = 64. - The network address is the first,
192.168.10.0. The broadcast address is the last,192.168.10.63. - Usable hosts:
.1to.62, which is 62.
Example 2: which /26 does 192.168.10.77 belong to?
A /26 divides the last octet into blocks of 64, the size worked out above: 0–63, 64–127, 128–191 and 192–255. The address ends in 77, so it is in the second block.
| Network address | First usable | Last usable | Broadcast |
|---|---|---|---|
192.168.10.64/26 | 192.168.10.65 | 192.168.10.126 | 192.168.10.127 |
A quick check: the network address is the largest multiple of the block size, 64, that does not exceed the address you started with. For 77 that is 64.
Splitting a network into subnets#
Each bit you add to the prefix halves the block. A /24 becomes two /25s, or four /26s, or eight /27s. To split 192.168.10.0/24 into four equal subnets you borrow two host bits and get /26:
| Subnet | Range | Usable hosts | Broadcast |
|---|---|---|---|
192.168.10.0/26 | .0 to .63 | .1 to .62 | .63 |
192.168.10.64/26 | .64 to .127 | .65 to .126 | .127 |
192.168.10.128/26 | .128 to .191 | .129 to .190 | .191 |
192.168.10.192/26 | .192 to .255 | .193 to .254 | .255 |
Subnets do not have to be the same size. Splitting with variable length subnet masks (VLSM) lets a /24 hold one /25 for a busy segment, one /26 for a department and two /27s for small ones, as long as each block starts on a boundary that is a multiple of its own size. The subnet calculator can split a block into equal parts and checks the arithmetic.
Going the other way
Contiguous, aligned blocks can be summarised into one route. Four consecutive /24s starting at a multiple of four, 192.168.0.0/24 to 192.168.3.0/24, are exactly 192.168.0.0/22. Routers do this constantly, and it is why the internet's routing table has hundreds of thousands of entries rather than billions.
Why subnet at all#
- Smaller broadcast domains. Broadcast traffic reaches every device in the subnet. Fewer devices, less noise.
- Separation. Guests, IoT devices, servers and staff can live on different subnets, with the router or firewall deciding what may cross between them.
- Planning. Subnets that map to floors, teams or roles make addresses easy to reason about, and easy to summarise.
- Containing faults. A misconfigured device or a broadcast storm stays in its own subnet.
Prefix lengths in IPv6#
The notation is the same and the numbers are bigger. Because IPv6 addresses are 128 bits, the sizes that matter are:
| Prefix | Meaning | Notes |
|---|---|---|
/128 | One address | The equivalent of an IPv4 /32 |
/64 | One subnet | The standard size for a local network, with 2^64 (18,446,744,073,709,551,616) addresses. Automatic address configuration expects it |
/56 or /48 | A home or site allocation | What an ISP normally delegates to a customer, so it can have many /64 subnets (RFC 6177) |
/32 | An ISP's allocation | The minimum block a registry normally allocates to a provider |
Common questions#
What is a wildcard mask?
The inverse of a subnet mask: ones where the mask has zeros. The wildcard for a /26 is 0.0.0.63. Some router and firewall rule languages use it instead of a prefix length.
What does 0.0.0.0/0 mean?
Every address. In a routing table it is the default route: where to send anything that no more specific entry matches.
Why can't I use the first and last address in a subnet?
They are taken: the first names the subnet itself and the last is the broadcast address for it. Point-to-point /31s and single-host /32s are the exceptions.
Try it on your own connection
Sources and further reading
Keep reading
- Addressing and routingIPv4 address classes explainedClassful addressing split IPv4 into classes A to E by the first bits. The ranges, default masks and host counts, and why CIDR replaced the system in 1993.
- Addressing and routingIPv4 vs IPv6: what changedIPv4 has 4.3 billion addresses and IPv6 has 340 undecillion. How the two differ, how to read IPv6 notation, why both are in use, and what it means for your privacy.
- Addressing and routingPublic vs private IP addressesYour devices have a private address from your router and share one public address with the internet. The ranges, how NAT links them, and how to tell which is which.
- FundamentalsThe complete guide to IP addressesOne reference for the whole subject: how addresses are built, the reserved ranges you will meet, how they are allocated and routed, and how to read a lookup result.
Published by My IP Address