Subnetting works by borrowing bits from the host portion of an IP address and reassigning them as network bits, which splits one large address block into several smaller, independently routable networks. The subnet mask (or prefix length) records exactly how many leading bits identify the network; everything after that boundary identifies the host within that subnet. That single mechanism—moving the network/host dividing line—is the whole idea, and nearly every subnetting calculation follows from it.
The phrase "dividing an address" deserves one clarification up front. In normal IPv4 subnetting you do not split the 32-bit address itself; you split the address space the address belongs to. An address like 192.168.10.37 is a single host address. The divisible thing is the block it sits in, such as 192.168.10.0/24, and subnetting cuts that block into smaller blocks. The address remains 32 bits either way—what changes is how many of those bits are interpreted as network versus host.
The network/host boundary is the lever
An IPv4 address is 32 bits. A subnet mask is also 32 bits, consisting of a run of 1s followed by a run of 0s. The 1s mark network bits; the 0s mark host bits. The prefix length is simply the count of 1s, so /24 means 24 network bits and 8 host bits.
Take 192.168.10.0/24. In binary the mask is 24 ones followed by eight zeros:
That leaves 2⁸ = 256 total addresses, of which 254 are usable for hosts on a classic IPv4 subnet (the all-zeros host value is the network address and the all-ones value is the broadcast address). When you change the prefix to /26, you have borrowed two bits from the host portion:
Now 2⁶ = 64 addresses per subnet, 62 usable, and the original /24 has become four /26 subnets. The address did not get longer or shorter. The dividing line moved two positions to the right.
Two formulas capture the arithmetic:
Number of subnets created = 2^(bits borrowed), when subdividing one block. Addresses per subnet = 2^(host bits remaining).
Borrowing more bits means more subnets but fewer hosts each. That trade-off is the entire design decision in subnetting.
A worked example, step by step
Suppose you administer 192.168.10.0/24 and need four subnets of roughly equal size.
Step 1: Decide how many bits to borrow. Four subnets require 2² = 4, so borrow 2 bits. The new prefix is /26.
Step 2: Compute the block size. With 6 host bits remaining, each subnet holds 2⁶ = 64 addresses. The "interesting octet"—the one the mask cuts through—advances in steps of 64: 0, 64, 128, 192.
Step 3: List the subnets.
| Subnet | Network address | Usable host range | Broadcast |
|---|---|---|---|
| 1 | 192.168.10.0/26 | .1 – .62 | .63 |
| 2 | 192.168.10.64/26 | .65 – .126 | .127 |
| 3 | 192.168.10.128/26 | .129 – .190 | .191 |
| 4 | 192.168.10.192/26 | .193 – .254 | .255 |
Step 4: Verify containment. Every address still falls inside the original 192.168.10.0/24. Nothing was created or destroyed; the same 256 addresses were partitioned into four groups.
Notice the pattern that makes subnetting fast in practice: the network address of each subnet is always a multiple of the block size in the octet where the mask ends. For a /26, block size 64, valid fourth-octet network values are 0, 64, 128, and 192—nothing else. If someone hands you 192.168.10.100/26, the network is 192.168.10.64 and the host is .36 within it, because 100 falls between 64 and 127.
Why the mask matters more than the address
A common source of confusion is that the same dotted-decimal address can belong to different networks depending on its mask. Consider 10.1.2.3:
As 10.1.2.3/24, the network is 10.1.2.0. As 10.1.2.3/16, the network is 10.1.0.0. As 10.1.2.3/28, the network is 10.1.2.0, but the host range is only .1–.14.
The address bits did not change; the interpretation did. Routers and hosts decide whether a destination is "local" or "remote" by comparing the destination against their own address using their own mask. Two devices on the same physical wire with mismatched masks can fail to communicate even though their addresses look adjacent. This is why the mask is not optional bookkeeping—it is part of the addressing information, and it travels with the address in routing tables and configuration.
Prefix notation and the mask are the same fact
The /26 notation and 255.255.255.192 are two encodings of one mask. Converting is mechanical: write the prefix as that many 1s, group into octets, read each octet as a decimal.
| Prefix | Mask | Host bits | Addresses per subnet | Usable hosts |
|---|---|---|---|---|
| /24 | 255.255.255.0 | 8 | 256 | 254 |
| /25 | 255.255.255.128 | 7 | 128 | 126 |
| /26 | 255.255.255.192 | 6 | 64 | 62 |
| /27 | 255.255.255.224 | 5 | 32 | 30 |
| /28 | 255.255.255.240 | 4 | 16 | 14 |
| /29 | 255.255.255.248 | 3 | 8 | 6 |
| /30 | 255.255.255.252 | 2 | 4 | 2 |
The /30 row is worth pausing on. With only two usable addresses, a /30 is the classic choice for point-to-point links between routers—one address for each end, nothing wasted. A /31 has zero usable addresses under the traditional rule, though RFC 3021 permits /31 on point-to-point links for exactly this reason; support depends on the equipment and is not universal. That is a genuine exception to the "network and broadcast are reserved" rule, not a contradiction of it.
What the reserved addresses actually are
For any subnet, the lowest address (all host bits zero) is the network address and the highest (all host bits one) is the broadcast address. Neither can be assigned to a host in ordinary IPv4 subnetting. This is why usable hosts equal total addresses minus two.
The broadcast address reaches every host in that subnet, but only that subnet—a broadcast to 192.168.10.127 does not leave the /26 containing it. That containment is one of the practical reasons to subnet: broadcast traffic stays within a smaller domain, and problems in one subnet do not flood the others.
Why divide at all
Subnetting exists because a flat network does not scale. On a single large broadcast domain, every host processes every broadcast, every device is a potential peer, and troubleshooting means looking at one undifferentiated pool.
Dividing an address block delivers several concrete benefits:
Smaller broadcast domains. Broadcast traffic is confined to each subnet, reducing load and the blast radius of broadcast storms. Routing and policy boundaries. Routers can apply access rules between subnets, so you can separate, say, guest devices from servers even when both use private addresses. Efficient address use. A point-to-point link can take a /30 instead of a /24, conserving addresses for hosts that need them. Organizational clarity. Subnets can map to floors, departments, or functions, which makes documentation and troubleshooting tractable. Security segmentation. Isolation between subnets is a structural control, not just a convention.
The cost is complexity: more subnets mean more routing entries, more configuration, and more chances for a mask mismatch. Subnetting is a design trade, not a free improvement.
Common points of confusion
"The network address is the first address." True for the subnet as a whole, but not "first" in the sense of lowest in the original block. A /26 subnet's network address can be .64, .128, or .192—each is a first address of its own subnet.
"Subnetting changes the IP address." It changes which part of the address is treated as network. The host keeps its address; the mask and the surrounding routing change.
"More subnets always means better." Only if you need the separation. Over-subnetting wastes addresses on tiny blocks and adds routing overhead.
"The mask can be any value." In classless (CIDR) addressing the mask must be contiguous 1s followed by 0s. 255.255.255.64 is not a valid mask because the bits are not contiguous. Modern equipment generally rejects or misbehaves with non-contiguous masks.
"Public and private addresses subnet differently." The mechanics are identical. Private ranges such as 10.0.0.0/8 and 192.168.0.0/16 are simply blocks reserved for internal use; you subnet them the same way you would any other block.
Variable-length subnetting and the limits of the simple model
The worked example used equal-sized subnets, which is the easiest case. Real networks often need different sizes—a /26 for a busy floor, a /30 for a router link, a /28 for a small lab. That is variable-length subnet mask (VLSM) design: allocate the largest subnets first, then carve smaller ones from the remaining space, always aligning each network address to its own block size. The rule is unforgiving—a /27 must start at a multiple of 32 in the relevant octet—so planning the order matters.
A related concept is supernetting or route aggregation: combining adjacent blocks into a larger prefix so a router can advertise one route instead of many. It uses the same boundary arithmetic in reverse, and it is why internet routing tables remain manageable despite the number of allocated blocks.
It is also worth noting what subnetting does not solve. It does not create address space—IPv4 exhaustion is addressed by NAT and by IPv6, not by subnetting. And in IPv6, subnetting is structurally simpler: the interface identifier is conventionally 64 bits, so a /64 per subnet is standard, and the arithmetic of borrowing host bits is mostly replaced by allocating a fixed-size subnet prefix from a larger block. The principle—a prefix length defines the network, the rest identifies the host—carries over unchanged.
A short practical checklist
When you need to divide a block, the reliable sequence is:
1: Count the subnets you need and the hosts per subnet. 2: Choose the prefix that satisfies the largest host requirement first. 3: Compute the block size as 2^(host bits). 4: Derive network addresses as multiples of the block size in the octet the mask cuts. 5: Identify each subnet's network, usable range, and broadcast address. 6: Confirm every piece still lies within the parent block and that masks are contiguous.
That procedure is just the arithmetic of moving the dividing line made explicit. Once you see subnetting as relocating the network/host boundary and letting the mask record where it landed, the tables, the multiples, and the reserved addresses all follow from the same rule rather than needing to be memorized separately.
The single most useful habit is to always write the prefix alongside the address. An address without its mask is ambiguous, and most subnetting mistakes in practice are not arithmetic errors but boundary errors—treating a /26 host as if it lived in a /24.