Slide a line across 32 bits to split one IP network into many — trading host capacity for more subnets.
An IPv4 address is just 32 bits, usually written as four 0–255 octets like 192.168.10.0. Subnetting is the art of drawing a line across those 32 bits: everything to the left of the line is the network part (shared by every device on the subnet), and everything to the right is the host part (numbering individual devices). The subnet mask marks exactly where that line falls.
The mask is a run of 1s followed by a run of 0s. The 1s cover the network bits, the 0s cover the host bits. /24 is shorthand for 24 network bits, the same as the mask 255.255.255.0, leaving 32 − 24 = 8 host bits. Slide the line one bit to the right and you double the number of subnets while halving the hosts in each — every extra prefix bit splits the block in two.
n host bits a subnet holds 2ⁿ addresses, but only 2ⁿ − 2 are usable. The all-zero host pattern is the network address (it names the subnet), and the all-one host pattern is the broadcast address (it reaches every host at once). Neither can be assigned to a device.Start with 192.168.10.0/24 — 256 addresses, 254 usable. To make 4 subnets you must distinguish 4 things, which needs 2 bits, so borrow 2 host bits: the prefix grows from /24 to /26. The new mask is 255.255.255.192 (the last octet 11000000 = 192). Each subnet now has 32 − 26 = 6 host bits → 2⁶ = 64 addresses, 62 usable. The subnets step by 64:
Base: 192.168.10.0/24 -> borrow 2 bits -> /26 (mask 255.255.255.192)
Subnet Range Network Broadcast Usable
.0 /26 .0 - .63 .0 .63 .1 - .62
.64 /26 .64 - .127 .64 .127 .65 - .126
.128 /26 .128 - .191 .128 .191 .129 - .190
.192 /26 .192 - .255 .192 .255 .193 - .254256 − (mask octet). Here 256 − 192 = 64, so subnets begin at multiples of 64: .0, .64, .128, .192. For any host address, its network address is the nearest multiple of the block size at or below it, and the broadcast is the next block minus one.