Technology & Internet

How IPv4 Subnetting Is Calculated

An IPv4 subnet's network address, broadcast address, and usable host range all come from applying the CIDR prefix as a bitmask to the IP address — with a special two-address exception for point-to-point /31 links.

The network address: applying the mask

For 192.168.1.10/24, the /24 prefix means the first 24 bits are the network portion — that gives a network address of 192.168.1.0, a broadcast address of 192.168.1.255, and 254 usable host addresses (192.168.1.1 through 192.168.1.254).

A smaller subnet, fewer usable hosts

The same IP address with a /28 prefix instead — a smaller subnet — gives a network address of 192.168.1.0, a broadcast of 192.168.1.15, and only 14 usable hosts (192.168.1.1 through 192.168.1.14). A longer prefix reserves more bits for the network portion, leaving fewer bits (and so fewer addresses) for hosts.

Why network and broadcast addresses are normally reserved

The network address identifies the subnet itself, and the broadcast address is used to reach every host on the subnet at once — neither can be assigned to an individual device, which is why a /24 subnet's 256 total addresses yield only 254 usable ones.