What Is the Hosts per Subnet Calculator?
This tool tells you how many usable IPv4 host addresses fit inside a subnet defined by a CIDR prefix length (for example /24 or /27). It is essential for network engineers, sysadmins, and anyone studying for certifications like CCNA who need to plan IP address space quickly and accurately.
How to Use It
Select your subnet prefix length from the dropdown — anything from /8 up to /32. The calculator instantly returns the number of usable hosts, the number of host bits, and the total number of addresses in the block. Pick a smaller prefix (like /16) for large networks and a larger prefix (like /29) for small point-to-point or device segments.
The Formula Explained
An IPv4 address is 32 bits. The prefix length tells you how many bits identify the network, leaving 32 − prefix bits for hosts. The total number of addresses is therefore \(2^{(32 - \text{prefix})}\). Two of those addresses are reserved: the network address (all host bits 0) and the broadcast address (all host bits 1). So the usable host count is:
$$\text{Usable Hosts} = 2^{\left(32 - \text{Prefix}\right)} - 2$$
Special cases: a /31 carries 2 addresses used as a point-to-point link (RFC 3021) and a /32 is a single host route.
Worked Example
For a /26 subnet: host bits = 32 − 26 = 6, total addresses = 2^6 = 64, and usable hosts = 64 − 2 = 62. That makes a /26 a popular choice for departmental LANs needing up to 62 devices.
$$\text{Usable Hosts} = 2^{\left(32 - 26\right)} - 2 = 2^{6} - 2 = 64 - 2 = 62$$
FAQ
Why subtract 2? The first address is the network identifier and the last is the broadcast address; neither can be assigned to a device.
What about a /30? A /30 has 4 total addresses and 2 usable hosts — the classic choice for router-to-router links before /31 became common.
Does this work for IPv6? No. IPv6 uses a 128-bit address space and does not reserve a broadcast address, so this 32-bit, minus-2 formula applies to IPv4 only.