Usable Hosts: \(2^{(32 - \text{CIDR})} - 2 \quad (\text{for } \text{CIDR} < 31)\)
Subnetting is the fundamental mathematical mechanism utilized in computer networking to partition an Internet Protocol version 4 (IPv4) address block into smaller, distinct sub-networks. By segmenting a 32-bit address space into Network Identifier and Host Identifier portions via Classless Inter-Domain Routing (CIDR), network engineers optimize routing table efficiency, minimize broadcast domain congestion, and enforce tight security perimeters across enterprise subnets.
The number of usable host addresses in an IPv4 subnet prefix is determined by: \(\text{Usable Hosts} = 2^{(32 - \text{CIDR})} - 2\). The subtraction of 2 addresses accounts for the Network Identifier (all host bits 0) and the Subnet Broadcast Address (all host bits 1).
4. In-Depth Worked Real-World Case Study
A standard /24 subnet has 32 - 24 = 8 host bits, yielding 2^8 = 256 total IP addresses and 254 usable client IPs with a subnet mask of 255.255.255.0. If partitioned into two /25 subnets, each /25 subnet possesses 7 host bits, providing 2^7 - 2 = 126 usable client IPs and a mask of 255.255.255.128.
Frequently Asked Questions (FAQ)
Why are 2 host addresses subtracted from an IPv4 subnet?
In standard IPv4 subnets (/30 or wider), the very first address represents the Network Identifier and the final address is reserved for the Subnet Broadcast Address, leaving \(2^{(32-\text{CIDR})} - 2\) usable client IPs.
What is the practical difference between a /24 and a /25?
A /24 holds 256 addresses with 254 usable hosts, while a /25 holds 128 addresses with 126 usable hosts. Splitting a /24 into two /25s gives you two separate networks that cannot talk to each other without a router, which is the whole point: segmentation for security, for departments, or for keeping broadcast traffic under control.
Can I subnet a subnet?
Yes, that is exactly how variable length subnet masking works. A /24 can be split into two /25s, and one of those /25s can be split again into two /26s, so different parts of a network get blocks sized to what they need. The rule is that the smaller blocks must still line up on their own boundaries, so keep a written plan of which block went where.
Does this calculator work for IPv6?
No. IPv6 uses 128-bit addresses and a completely different way of thinking about subnets, with a /64 as the standard size for a single network segment. The maths here is IPv4 only, so if you are planning IPv6 space, use a calculator built for it rather than trying to stretch these rules.


