What an IPv6 prefix actually contains
An IPv6 address is 128 bits, written as eight groups of four hexadecimal digits. A prefix length, the /n after the address, says how many of those leading bits are fixed by the allocation. Everything to the right of the prefix is yours to assign. So the size of a block is decided by one subtraction: 128 − n host bits, and 2128−n addresses.
The numbers stop being intuitive almost immediately. A single /64 — the standard size of one IPv6 LAN — contains 18,446,744,073,709,551,616 addresses, roughly four billion times the entire IPv4 space. That is deliberate. IPv6 was designed so that you never subnet to fit hosts; you subnet to fit segments. The question a network engineer asks is not “how many addresses do I need on this VLAN” but “how many VLANs does this site need, and does my allocation have room for them.”
That is what this calculator answers. Give it the block your provider or your registry delegated to you, tell it what size you want to cut it into, and it reports how many of those subnets exist, where the block starts and ends, and how much space each subnet holds. If you are working in IPv4, the equivalent tools are the IPv4 subnet calculator and the IPv4 host count calculator, where usable host counts are reduced by the network and broadcast addresses. IPv6 has neither, which is one of the few places the arithmetic gets simpler.
The two formulas, and why they are the only two you need
Prefix arithmetic is base-2 arithmetic and nothing else. Two expressions cover every question anyone asks about an IPv6 block.
Address count. A prefix of length n leaves 128 − n host bits, and each bit doubles the space, so the block holds 2128−n addresses. A /48 leaves 80 host bits and holds 280 ≈ 1.2089 × 1024 addresses.
Subnet count. Cutting a /a into pieces of size /b means fixing b − a more bits, and each fixed bit doubles the number of pieces, so you get 2b−a subnets. Going from /48 to /64 borrows 16 bits and yields 216 = 65,536 subnets. Going from /56 to /64 borrows 8 and yields 256.
Finding the boundaries is a masking operation. The mask has n ones followed by 128 − n zeros. Bitwise-AND the address with the mask and every host bit is cleared, giving the first address in the block. OR the address with the inverse of the mask and every host bit is set, giving the last. Equivalently, last = first + 2128−n − 1.
Two conventions govern how the result is written down. RFC 4291 defines the address architecture, including the rule that the low 64 bits of most unicast addresses are an interface identifier. RFC 5952 defines the canonical text form used throughout this page: lower-case hex, no leading zeros inside a group, and a single :: replacing the longest run of two or more all-zero groups, choosing the leftmost run when two runs tie. Following one text form matters more than it sounds — access-control lists, log searches and configuration diffs all compare addresses as strings.
Worked example: carving 2001:db8:abcd::/48 into /64 LANs
A site receives 2001:db8:abcd::/48 and needs one /64 per VLAN. Work it out on paper.
- Count the host bits. 128 − 48 = 80 host bits. The block holds 280 = 1,208,925,819,614,629,174,706,176 addresses, which this calculator prints as 1.2089 × 1024.
- Count the borrowed bits. Going from /48 to /64 fixes 64 − 48 = 16 more bits.
- Count the subnets. 216 = 65,536 separate /64 networks. Those 16 bits are exactly the fourth hextet, so the subnets run 2001:db8:abcd:0000::/64 through 2001:db8:abcd:ffff::/64 — a convenient accident of /48 and /64 both landing on hextet boundaries.
- Find the first address. Clear all 80 host bits: 2001:0db8:abcd:0000:0000:0000:0000:0000, written 2001:db8:abcd:: in canonical form.
- Find the last address. Set all 80 host bits: 2001:db8:abcd:ffff:ffff:ffff:ffff:ffff. Note there is no
::here, because there is no run of zero groups left to compress. - Size one subnet. Each /64 leaves 128 − 64 = 64 host bits, so 264 = 18,446,744,073,709,551,616 addresses per LAN.
- Check the total. 65,536 subnets × 264 addresses = 216 × 264 = 280, which matches step 1. Whenever the two multiply back to the parent, the split is consistent.
With 65,536 VLAN-sized networks available, most sites will never structure the allocation flat. A common pattern is to spend four bits on a location code, giving 16 sites, and four more on a function code, giving 16 functions per site, before the remaining eight bits enumerate individual segments. The bits are free; the readability is what you are buying.
How to read the result and choose a prefix length
Start from the /64. RFC 4291 fixes the interface identifier of most unicast addresses at 64 bits, and stateless address autoconfiguration builds an address by concatenating a 64-bit prefix with a 64-bit identifier. A link with a prefix longer than /64 cannot use SLAAC, so hosts on it need DHCPv6 or static configuration. That is fine for a router-to-router link and wrong for a user VLAN. If you see a warning above about a target longer than /64, that is what it means.
Above the /64, the standard sizes come from registry policy rather than from the protocol. RFC 6177 replaced the earlier blanket recommendation of a /48 for every end site with the advice that end sites should get a prefix short enough to allow multiple subnets — in practice a /48 for an enterprise site and a /56 or /48 for a residential subscriber. A /56 gives 256 LANs; a /60 gives only 16 and starts to pinch on a network with guest, IoT and management segments. If your provider hands out a /64 and nothing shorter, you cannot subnet at all without breaking SLAAC, and that is a reason to ask for a delegation rather than a reason to design around it.
Interpret the borrowed-bit count as your structural budget. Sixteen bits between a /48 and a /64 is room for a hierarchy; eight bits between a /56 and a /64 is room for a flat list. Spending bits on structure costs you nothing in usable addresses, because no IPv6 network is ever short of host addresses inside a /64.
One practical read on the last address: it is the highest address in the block and it is assignable. IPv6 defines no broadcast address, and the all-zeros host portion is the subnet-router anycast address rather than an unusable network number. So a /64 gives you 264 addresses to use, not 264 − 2. Compare that with IPv4, where the subnet mask and CIDR converter has to subtract two on every block wider than a /31.
IPv6 prefix length reference
| Prefix | Host bits | /64 subnets inside | Total addresses | Typical use |
|---|---|---|---|---|
| /32 | 96 | 4,294,967,296 | 7.9228 × 1028 | Minimum allocation to an ISP or LIR |
| /36 | 92 | 268,435,456 | 4.9518 × 1027 | Regional block inside an ISP |
| /40 | 88 | 16,777,216 | 3.0949 × 1026 | Large enterprise, multi-region |
| /44 | 84 | 1,048,576 | 1.9343 × 1025 | Enterprise with many sites |
| /48 | 80 | 65,536 | 1.2089 × 1024 | Standard end-site allocation |
| /52 | 76 | 4,096 | 7.5558 × 1022 | Branch office delegation |
| /56 | 72 | 256 | 4.7224 × 1021 | Common residential delegation |
| /60 | 68 | 16 | 2.9515 × 1020 | Small delegation, tight for guest and IoT VLANs |
| /64 | 64 | 1 | 18,446,744,073,709,551,616 | One LAN; the SLAAC boundary |
| /127 | 1 | — | 2 | Router-to-router link (RFC 6164) |
| /128 | 0 | — | 1 | Loopback or single host route |
A /127 or /128 sits below the /64 boundary, so SLAAC does not apply and the /64 column is not meaningful for those rows.
Mistakes that produce a wrong IPv6 plan
- Subnetting longer than /64 on a host LAN. The addresses exist, but SLAAC does not work above the 64-bit boundary, and some stacks behave badly on a /112 or /120. Keep host segments at /64 and spend the abundance elsewhere.
- Reading a prefix that is not on a nibble boundary. A /49 or /51 is legal and the mathematics is unchanged, but the block no longer starts and ends at a clean hex digit, which makes reverse DNS delegation and eyeball verification much harder. Allocate on multiples of 4 unless you have a reason not to.
- Assuming two addresses are unusable. That habit comes from IPv4. IPv6 has no broadcast address, and the all-zeros host address is the subnet-router anycast address rather than a forbidden network number.
- Writing addresses inconsistently. 2001:0DB8:0000::1 and 2001:db8::1 are the same address, but string comparison in a log search, an ACL diff or a spreadsheet says otherwise. Normalise to RFC 5952 form once and keep it.
- Compressing a single zero group. RFC 5952 forbids using
::for a run of exactly one zero group, so 2001:db8:0:1:1:1:1:1 stays as written. This calculator applies that rule. - Planning from host counts. Sizing an IPv6 segment to the number of devices on it is the IPv4 reflex, and it produces a design that is both harder to read and unable to use SLAAC. Size by segment count instead.
Where this fits with the rest of an address plan
This calculator handles the arithmetic of one prefix. A full address plan also needs an allocation policy — which bits mean location, which mean function, and which are left as growth — and that is a design decision no calculator makes for you. The usual advice is to allocate on nibble boundaries, to leave the middle bits sparse so that adjacent allocations can be aggregated later, and to write the plan down before configuring anything.
For addresses that never leave your network, RFC 4193 defines unique local addresses in fd00::/8, where you generate a random 40-bit global ID and get a /48 of your own. Those blocks divide exactly the same way, so everything on this page applies to them unchanged.
Two neighbouring tools cover the IPv4 side of a dual-stack design. The VLSM subnet design calculator allocates variable-sized IPv4 subnets from a parent block, an exercise that has no IPv6 counterpart precisely because IPv6 does not force you to right-size segments. The wildcard mask calculator converts an IPv4 prefix into the inverse mask used by Cisco access lists and OSPF network statements; IPv6 ACLs take a prefix directly, so no inversion is needed there.
Finally, remember that prefix arithmetic says nothing about reachability. A block that divides perfectly can still be unrouted, filtered, or unreachable because the provider is not announcing it. Confirm the allocation in the registry, then confirm the route, then subnet.
Key terms
- Prefix length
- The number of leading bits fixed by an allocation, written after a slash. A /48 fixes the first 48 bits and leaves 80 for you.
- Hextet
- One of the eight 16-bit groups in an IPv6 address, written as up to four hex digits. Prefix lengths that are multiples of 16 land exactly on hextet boundaries.
- Interface identifier
- The low 64 bits of a typical unicast address, formed by the host. RFC 4291 fixes its length at 64 bits, which is why /64 is the standard LAN size.
- SLAAC
- Stateless address autoconfiguration — the mechanism by which a host builds its own address from a router-advertised /64 prefix plus a locally generated interface identifier.
- Subnet-router anycast
- The address with all host bits zero. Every router on the link answers to it, so unlike IPv4 it is not an unusable network number.
