Count remaining bits in the correct family
IPv4 has 32 address bits; IPv6 has 128. Raw count is 2^(width − prefix). IPv4 /24 therefore has 256 addresses, while IPv6 /64 has 2^64 addresses. A /64 is invalid in IPv4 rather than an extremely small IPv4 network.
| Property | IPv4 | IPv6 |
|---|---|---|
| Address width | 32 bits | 128 bits |
| Example prefix | /24 | /64 |
| Raw address count | 256 | 18,446,744,073,709,551,616 |
Apply family-specific conventions
A traditional IPv4 broadcast subnet often reserves the first network label and final broadcast address, producing 254 traditional hosts in a /24. The /31 point-to-point exception and /32 host range need separate treatment. IPv6 has no IPv4-style broadcast address, so subtracting two is not its raw counting rule.
Normalize notation without changing width
IPv4 is commonly written as four decimal octets. IPv6 uses hexadecimal groups and permits zero compression with ::. Compression shortens the text but not the underlying 128-bit value. A calculator should normalize the containing prefix by clearing host bits in either family.
Keep IPv6 counts exact
IPv6 ranges exceed the exact-integer capacity of ordinary floating-point numbers. Use exact integer values for counts and boundaries, and keep them as strings when passing through a serialization layer. A rounded count may look reasonable while losing low-order bits needed for a boundary check.
Separate arithmetic from network design
Range counts do not determine active devices, safe allocation density, firewall scope or routing policy. Documentation prefixes such as 192.0.2.0/24 and 2001:db8::/32 are useful examples, not production allocation suggestions. Check standards and your operational context before configuring a network.
Apply the same prefix logic with different widths
IPv4 192.0.2.130/25 clears seven host bits to network 192.0.2.128 and ends at 192.0.2.255. It has 128 raw addresses. IPv6 2001:db8::5/126 clears two host bits to 2001:db8::4 and ends at ::7, with four raw addresses. A shorter text label does not imply a shorter bit width.
The address family determines valid prefix bounds. IPv4 /33 and IPv6 /129 are invalid. A normalized network should preserve the fixed prefix bits and clear only host bits; keeping the original input allows an audit of which endpoint was examined.
Count child prefixes without host-reservation subtraction
A /24 IPv4 block contains 2^(28 − 24) = sixteen /28 blocks. A /48 IPv6 block contains 2^(64 − 48) = 65,536 /64 blocks. These are counts of prefixes, not device counts. Subtracting two from each child block does not change how many child blocks fit inside the parent.
Arithmetic partitioning assumes alignment. Choosing an arbitrary start inside a block does not create a valid prefix boundary of any desired size. The calculator can derive the containing boundary; an operational allocation still needs route and addressing-policy review.
Examine tiny ranges without a universal “usable” rule
Traditional IPv4 /30 reserves the network and broadcast labels, leaving two usual hosts. RFC 3021 permits both /31 addresses on a point-to-point link. A /32 is one address. IPv6 /127 has two raw addresses and /128 one; their deployment roles should not be inferred by copying IPv4 subtraction.
The label “usable hosts” must therefore declare its convention. An exact total is a binary range property. Reserved roles, local policy and protocol-specific behavior determine practical use. Advertising every raw address as freely deployable would overstate what the arithmetic proves.
Preserve strings at serialization boundaries
A /64 count of 18,446,744,073,709,551,616 is greater than the ordinary safe floating-point integer range. Exact internal arithmetic can still be spoiled if a client converts that output string to a Number. Keep range counts and large integer boundaries as text or an explicit exact-integer type. Prefer documentation address ranges for reproducible examples, and never treat an example prefix as an allocation grant or a configuration instruction.
Questions and checks
Does IPv6 /64 mean 64 addresses?
No. It leaves 64 bits, producing 2^64 raw addresses.
Should two be subtracted for IPv6 network and broadcast?
No. IPv6 does not use the traditional IPv4 broadcast-pair convention.
Does a normalized network preserve the entered host address?
It identifies the containing block. Keep the original address separately if you need the endpoint.
Sources and scope
The examples are illustrative calculations, not records of individual users. Check the policy or measurements that apply to your situation.
Try the calculations
Subnet Calculator
Calculate IPv4 or IPv6 network boundaries, mask, last address and exact address count. Compressed IPv6 and embedded IPv4 tails are accepted; IPv6 counts remain exact decimal strings.
Open calculator →CIDR Calculator
Calculate IPv4 or IPv6 network boundaries, mask, last address and exact address count. Compressed IPv6 and embedded IPv4 tails are accepted; IPv6 counts remain exact decimal strings.
Open calculator →Binary Hex Decimal Converter
Convert unsigned whole numbers among binary, decimal and hexadecimal without losing integer precision. Enter digits only, excluding prefixes such as 0x and 0b.
Open calculator →