Total Hosts Calculator
Calculate total number of addresses in a subnet (IPv4/IPv6)
Input CIDR Addresses
Total hosts = 2^(32 - prefix). This includes the network and broadcast addresses.
Total Addresses
Host counts will appear here
The Total Hosts Calculator computes the complete count of IP addresses within any subnet, including the reserved network and broadcast addresses. Enter a CIDR prefix length to see the total number of addresses for both IPv4 and IPv6, displayed in human-readable format.
Understanding Total Address Counts
The total address count of a subnet is the raw mathematical answer to the question "how many IP addresses exist in this block?" It includes every address -- the network address, the broadcast address, and all the host addresses in between. This number is different from the usable host count (which subtracts the two reserved addresses), and understanding the distinction matters more than you might expect.
The formula is simply 2 raised to the power of the number of host bits. For IPv4, that means 2^(32 - prefix_length). A /24 has 8 host bits, so 2^8 = 256 total addresses. A /20 has 12 host bits, so 2^12 = 4,096 total addresses. The math is the same for IPv6, but with 128-bit addresses the numbers become astronomically large: a /64 has 2^64 addresses, which is roughly 18.4 quintillion.
Why would you care about the total count rather than just the usable count? Several practical reasons. Cloud providers charge per IP address in some pricing models, and they count total addresses, not usable ones. When calculating IP address utilization for RIR reporting (required to justify additional allocations), you report against total space. When planning address blocks hierarchically -- dividing a /16 into /20s, then /24s, then /28s -- you need the total counts to make sure your math adds up without gaps or overlaps. And when communicating with non-technical stakeholders about address capacity, the total count is often the more intuitive number.
How to Calculate Total Addresses in a Subnet
- Enter a prefix length (e.g.,
/24) or a full CIDR block (e.g.,192.168.1.0/24) - Select IPv4 (32-bit) or IPv6 (128-bit) address family
- The calculator applies the formula: 2^(address bits - prefix length)
- The result shows the raw total address count, including network and broadcast addresses
Total Address Count by Prefix Length
IPv4 (32-bit addresses)
| Prefix | Host Bits | Total Addresses | Human-Readable | Typical Use |
|---|---|---|---|---|
/8 | 24 | 16,777,216 | ~16.7 million | Large ISP / RIR allocation |
/12 | 20 | 1,048,576 | ~1 million | Private range 172.16.0.0/12 |
/16 | 16 | 65,536 | ~65.5 thousand | Campus / site block |
/20 | 12 | 4,096 | 4,096 | Large VLAN |
/24 | 8 | 256 | 256 | Standard LAN |
/25 | 7 | 128 | 128 | Half of a /24 |
/26 | 6 | 64 | 64 | Small department |
/27 | 5 | 32 | 32 | Server VLAN |
/28 | 4 | 16 | 16 | Small DMZ |
/29 | 3 | 8 | 8 | Tiny subnet |
/30 | 2 | 4 | 4 | Point-to-point link |
/31 | 1 | 2 | 2 | Point-to-point (RFC 3021) |
/32 | 0 | 1 | 1 | Single host / loopback |
IPv6 (128-bit addresses)
| Prefix | Host Bits | Total Addresses | Scale |
|---|---|---|---|
/32 | 96 | 2^96 | ~79.2 octillion |
/48 | 80 | 2^80 | Standard org allocation |
/56 | 72 | 2^72 | Residential allocation |
/64 | 64 | 2^64 | ~18.4 quintillion (single subnet) |
/128 | 0 | 1 | Single host / loopback |
When to Use This Tool
- Capacity planning -- understand the raw address space before subtracting reserved addresses
- Cloud cost estimation -- some providers charge per IP address, so total count directly affects cost
- IP address inventory -- track what percentage of your allocated space is in use
- Comparing subnetting schemes -- evaluate trade-offs between different prefix lengths
- Understanding IPv4 exhaustion -- visualize how the entire 2^32 space (4.29 billion addresses) is partitioned
- RIR utilization reporting -- calculate address space utilization for ARIN, RIPE, or APNIC
How Total Address Calculation Works
The Formula
The total number of addresses in any subnet is determined by the number of host bits:
Total addresses = 2^(address_bits - prefix_length)
For IPv4 (32-bit):
/24β 2^(32-24) = 2^8 = 256/20β 2^(32-20) = 2^12 = 4,096/16β 2^(32-16) = 2^16 = 65,536
For IPv6 (128-bit):
/64β 2^(128-64) = 2^64 = 18,446,744,073,709,551,616/48β 2^(128-48) = 2^80
Total Addresses vs. Usable Hosts
| Metric | Formula | /24 Example | /30 Example |
|---|---|---|---|
| Total addresses | 2^host_bits | 256 | 4 |
| Usable hosts | 2^host_bits - 2 | 254 | 2 |
| Difference | Network + broadcast | 2 reserved | 2 reserved |
The distinction matters most for small subnets. A /30 has only 4 total addresses, and 2 are reserved, leaving just 2 for hosts. A /24 has 256 total, with 254 usable -- the overhead is negligible.
IPv4 Address Space in Perspective
The entire IPv4 address space contains 2^32 = 4,294,967,296 addresses. A single /8 block represents 1/256th of all IPv4 addresses:
/8 = 16,777,216 addresses β 0.39% of IPv4 space
/16 = 65,536 addresses β 0.0015% of IPv4 space
/24 = 256 addresses β 0.000006% of IPv4 space
With approximately 4.3 billion total addresses and billions of internet-connected devices, IPv4 address exhaustion drove the adoption of IPv6 with its 2^128 address space.
Total Address Counts in Practice
Understanding the total address count is critical for hierarchical address planning. When you receive a /16 block and need to divide it among multiple sites, you need to know that a /16 contains exactly 256 contiguous /24 blocks, or 16 /20 blocks, or 4 /18 blocks. The math must add up perfectly -- any gap means wasted addresses, and any overlap means routing conflicts. A simple way to verify your plan: the total addresses in all child subnets must equal the total addresses in the parent block.
In cloud environments, the total address count takes on financial significance. AWS, for example, charges for Elastic IP addresses that are allocated but not attached to running instances. Understanding how many addresses a subnet contains helps you estimate costs and avoid over-provisioning. If you allocate a /20 (4,096 addresses) for a workload that only needs 50 instances, you are reserving far more address space than necessary, which could have implications for your VPC design and routing table complexity.
For organizations that hold their own IP address allocations from a Regional Internet Registry, tracking total address utilization is a reporting requirement. ARIN, RIPE NCC, and APNIC require periodic justification that allocated space is being used efficiently, typically expecting 80% or higher utilization before approving additional allocations. The total address count is the denominator in this utilization calculation.
Frequently Asked Questions
What is the difference between total hosts and usable hosts?
Total hosts is the raw mathematical count of all addresses in a subnet (2^host_bits), including the network and broadcast addresses. Usable hosts subtracts 2 from that total because the network address and broadcast address are reserved and cannot be assigned to devices. For a /24, total is 256 but usable is 254.
How many total addresses are in a /16 subnet?
A /16 subnet contains 2^(32-16) = 2^16 = 65,536 total addresses. After subtracting the network and broadcast addresses, 65,534 are usable. The /16 is equivalent to the old Class B network size and is commonly used for campus-level or site-level address blocks.
Why does IPv6 /64 have so many addresses?
A /64 prefix leaves 64 host bits, yielding 2^64 = approximately 18.4 quintillion addresses. This astronomical number is by design -- IPv6 allocates a /64 to every subnet so that SLAAC (Stateless Address Autoconfiguration) can use the full 64-bit Interface Identifier. Address conservation within a single subnet is intentionally not a concern in IPv6.
How many /24 subnets fit in a /16?
A /16 contains 65,536 total addresses, and a /24 contains 256. Dividing: 65,536 / 256 = 256 /24 subnets fit exactly in a /16. More generally, the number of smaller subnets in a larger one is 2^(smaller_prefix - larger_prefix).
How do I calculate the total addresses for an arbitrary range like 10.0.0.0 to 10.0.3.255?
This range spans from 10.0.0.0 to 10.0.3.255, which is 4 x 256 = 1,024 addresses. This corresponds to a /22 subnet (2^10 = 1,024). If the range does not align to a single CIDR block, you would need to sum the total addresses of the individual CIDR blocks that cover the range.
Related Tools
- Usable Hosts Calculator - Calculate number of usable host addresses in a subnet
- IPv4 Subnet Calculator - Calculate network, broadcast, and host range from CIDR notation
- IPv6 Subnet Calculator - Calculate IPv6 prefix ranges and address boundaries
- First/Last Usable Host Calculator - Find the first and last usable host addresses in a subnet
- Netmask β CIDR Converter - Convert between subnet mask notation and CIDR prefix length
- Subnet Allocation Planner - Plan hierarchical subnet allocations for multi-site networks