IPv4 CIDR Block Sizes and Address Counts

Exact address counts for every IPv4 CIDR prefix from /0 to /32, with usable-host exceptions, subnet boundaries and runnable Python checks.

An IPv4 CIDR block contains exactly 2^(32 − prefix length) addresses. A /24 has 256 addresses, a /16 has 65,536, and a /32 has one. This reference separates total addresses from assignable hosts, shows every prefix size, and gives you runnable checks for subnet boundaries.

TL;DR

IPv4 CIDR address counts

The prefix after the slash counts network bits. IPv4 has 32 bits, so the remaining bits determine the block's address count. A larger prefix number means a smaller address block.

To check one block, the subnet calculator shows its range, mask and host count.

CIDR prefixTotal addressesSubnet mask
Overall IPv4 space: /04,294,967,2960.0.0.0
/12,147,483,648128.0.0.0
/21,073,741,824192.0.0.0
/3536,870,912224.0.0.0
/4268,435,456240.0.0.0
/5134,217,728248.0.0.0
/667,108,864252.0.0.0
/733,554,432254.0.0.0
/816,777,216255.0.0.0
/98,388,608255.128.0.0
/104,194,304255.192.0.0
/112,097,152255.224.0.0
/121,048,576255.240.0.0
/13524,288255.248.0.0
/14262,144255.252.0.0
/15131,072255.254.0.0
/1665,536255.255.0.0
/1732,768255.255.128.0
/1816,384255.255.192.0
/198,192255.255.224.0
/204,096255.255.240.0
/212,048255.255.248.0
/221,024255.255.252.0
/23512255.255.254.0
/24256255.255.255.0
/25128255.255.255.128
/2664255.255.255.192
/2732255.255.255.224
/2816255.255.255.240
/298255.255.255.248
/304255.255.255.252
/312255.255.255.254
/321255.255.255.255

The largest block, /0, contains 4,294,967,296 addresses; the smallest, /32, contains one. Each step down the table halves the address count. A /24 is twice the size of a /25, not one address larger.

Methodology: these are exact calculations from IPv4's 32-bit address structure and CIDR prefix notation, described in RFC 4632, published August 2006, rather than sampled performance averages. The scope is address-space cardinality; the table does not establish public routability, allocation rights, assignable host capacity, or active proxy exits.

Why this matters

A subnet size answers a counting question. It does not answer whether you can assign every address, reach every address, or use every address as a distinct outbound identity. Keep those questions separate when you review an infrastructure plan.

For your network inventory, record both the canonical CIDR and the resource it represents. A routed allocation, a firewall rule, an interface subnet, and a proxy endpoint list can contain the same prefix while describing different operational objects.

Total addresses versus usable hosts

For a conventional broadcast subnet, subtract two addresses from the total: one network address and one directed broadcast address. A /24 therefore has 256 total addresses and 254 conventional host addresses. A /30 has four total addresses and two conventional host addresses.

Do not apply that subtraction blindly to /31 and /32. RFC 3021, published December 2000, specifies using both addresses of a /31 on an IPv4 point-to-point link. A /32 identifies a single address, commonly used in a host route or an exact-address rule.

PrefixTotal addressesHost interpretationBest for
/24256254 conventional host addressesA subnet requiring more than /25 capacity
/25128126 conventional host addressesA smaller broadcast subnet
/3042 conventional host addressesA two-endpoint subnet using conventional addressing
/312Both addresses on an RFC 3021 linkSupported point-to-point links
/321One individual addressHost routes and exact-address rules

The advantage of /31 is address efficiency for its specified link type. Its limitation is that it is not a replacement for a multi-host broadcast subnet. Confirm support at both endpoints before assigning it.

A /32 provides the narrowest address match. It does not provide a second endpoint address or a shared subnet for multiple hosts. Choose it when the configuration object represents one address, not because the host-count formula appears convenient.

These interpretations describe protocol-level addressing. Your hosting environment can reserve additional addresses. Use the environment's documented reservation rules before you promise capacity to an application team.

Use the counts to size a subnet

Use the counts as fixed arithmetic in your planning worksheet. Do not treat them as throughput targets or recommendations about request volume.

A smaller subnet reduces unused address space but leaves less room for growth. A larger subnet provides more addresses but expands the range covered by subnet-based rules. Make that trade-off explicit instead of choosing /24 by habit.

Read a CIDR block without guessing

Consider 192.0.2.128/26. The prefix leaves six host bits, so the block contains 64 addresses. Its subnet mask is 255.255.255.192.

The network address is 192.0.2.128, and the last address is 192.0.2.191. On a conventional broadcast subnet, the host range runs from 192.0.2.129 through 192.0.2.190, giving 62 host addresses.

The example uses documentation address space defined in RFC 5737, published January 2010. Do not substitute these example addresses for a real deployment allocation.

Check the boundary, not just the prefix

An address followed by a prefix is not necessarily the canonical network address. For example, 192.0.2.150/26 identifies an address inside 192.0.2.128/26; it does not create a block starting at .150.

For a /26 inside this /24, the valid starting positions are .0, .64, .128, and .192. The block containing .150 starts at .128 because the network bits select that aligned range.

Preserve host-bit errors during validation. Automatically converting an invalid network input into its containing network can hide a configuration mistake, especially in a permitted-destinations list or routing change.

Verify address counts with Python

Python's standard-library ipaddress module lets you check counts, masks, and boundaries without adding a dependency. Run this example with Python 3:

from ipaddress import ip_network

network = ip_network('192.0.2.128/26', strict=True)
hosts = network.hosts()
first_host = next(hosts)
last_host = first_host
host_count = 1

for address in hosts:
    last_host = address
    host_count += 1

print('network:', network.network_address)
print('prefix:', network.prefixlen)
print('mask:', network.netmask)
print('total addresses:', network.num_addresses)
print('last address:', network.broadcast_address)
print('first host:', first_host)
print('last host:', last_host)
print('host count:', host_count)

The example reports 64 total addresses and 62 host addresses. It also exposes the distinction between the network boundary and the first conventional host address.

This iteration is appropriate for the small example subnet. For a large block, use network.num_addresses to get the total immediately rather than visiting every address. Do not expand a /8 into a list just to count its 16,777,216 entries.

Reject noncanonical network inputs

Use strict parsing when the input field expects a network, not an interface address. This example demonstrates the error and then shows the containing network explicitly:

from ipaddress import ip_network

value = '192.0.2.150/26'

try:
    print(ip_network(value, strict=True))
except ValueError as error:
    print('Rejected:', error)
    print('Containing network:', ip_network(value, strict=False))

Strict parsing rejects the input because it has host bits set. Non-strict parsing returns 192.0.2.128/26. Both behaviors are useful, but they belong in different workflows: validation should flag the mismatch; an address lookup can intentionally find the containing block.

For a configuration review, store the submitted value alongside any normalized value. That makes an unintended expansion visible before a firewall or route change reaches production.

Split and aggregate blocks correctly

Splitting a block adds prefix bits and reduces each child's address count. A /24 splits into two /25 blocks, four /26 blocks, or eight /27 blocks. The total address count stays 256 when the children cover the parent without overlap.

For example, 192.0.2.0/25 and 192.0.2.128/25 together cover 192.0.2.0/24. They are adjacent, equal-sized, and aligned for that aggregate.

Adjacency alone is insufficient. 192.0.2.64/26 and 192.0.2.128/26 are adjacent, but they do not form a single /25: their combined range crosses a /25 boundary. Keep them as separate blocks unless you deliberately accept a broader range.

Aggregate only when the replacement covers exactly the intended addresses. A convenient shorter rule can include addresses that were absent from the original rules. For an access-control list, that changes permissions rather than merely simplifying notation.

What CIDR does not tell you about proxies

A CIDR identifies an address range. It does not identify the authentication method, supported protocol, concurrency allowance, or mapping between a proxy endpoint and an outbound address.

An endpoint's listening address is also not automatically its exit address. Check the address observed by the destination when you need to confirm outbound identity. Record that observation separately from the endpoint configuration.

For scraping workloads, keep three inventories separate: configured endpoints, observed exit addresses, and permitted concurrent connections. Combining them into one capacity number obscures what you actually measured.

In a capacity review, verify the account's documented limits and test the workload you intend to run. CIDR arithmetic remains useful for checking address ranges, but it cannot establish request success rates or endpoint performance. Node4's rotating proxies page states the connection limits for that product directly; see pricing for the rest.

FAQ

How many addresses are in an IPv4 subnet CIDR block?

An IPv4 subnet CIDR block contains 2^(32 minus the prefix length) addresses. A /24 contains 256, a /16 contains 65,536, and a /32 contains one.

Does a /24 have 256 usable IP addresses?

A /24 has 256 total addresses and 254 conventional host addresses on a broadcast subnet. Your hosting environment can reserve additional addresses, so check its assignment rules.

Is a /16 bigger than a /24?

A /16 is larger: it contains 65,536 addresses, compared with 256 in a /24. Increasing the prefix length makes the address block smaller.

What is the subnet mask for a /26?

The subnet mask for a /26 is 255.255.255.192. The block contains 64 total addresses and 62 conventional host addresses.

Can I use both addresses in a /31?

Yes, both addresses can serve as endpoints on an IPv4 point-to-point link under RFC 3021. Confirm that both endpoints support that configuration; do not apply it as a conventional multi-host subnet.

Does a /32 mean one usable host?

A /32 identifies one IPv4 address. It is useful for a host route or an exact-address rule, but it does not create a shared subnet with another endpoint.

Does a proxy provider's /24 give my account 256 exits?

No, a /24 establishes only that the block contains 256 addresses. Account assignments, routing, and the service's endpoint-to-exit behavior determine which exits your requests use.

Do IPv4 CIDR address counts ever change?

No, the address counts are fixed by IPv4's 32-bit structure. Operational reservation policies affect assignment, not the mathematical size of a prefix.

One last thing

A broader CIDR match can include more than hosts. A permit rule for 192.0.2.0/24 matches all 256 addresses in that range, even though conventional subnet host arithmetic yields 254. Address matching and host assignment are different operations.

Before deploying a range-based rule, check its first address, last address, and total count. Then confirm that every included address belongs in the rule. That small check catches mistakes a correct prefix calculation alone cannot catch.

Related guides