IPv6 Subnet & Prefix Calculator

Give this calculator an IPv6 prefix and a target subnet size and it returns the first and last address in the block, how many subnets of the target size fit inside it, and how many addresses each one holds. It writes every address in the canonical form defined by RFC 5952 and also shows the fully expanded 32-digit version, which is what you need when you are building reverse DNS zones or matching addresses in a firewall rule. Because IPv6 prefixes are pure bit arithmetic, the answers are exact: a /48 split into /64s always yields 65,536 subnets, on every network, everywhere.

Calculator

This calculator runs in your browser. Enable JavaScript for live results — the inputs, formula and worked example below remain fully readable without it.

Inputs this calculator takes, with typical values
InputWhat to enterExample
IPv6 address or prefixAny address inside the block, in compressed or expanded form. A trailing /n is ignored — set the prefix length below.2001:db8:abcd::
Prefix length of the blockThe number of leading bits fixed by the allocation — /48 for a typical site, /56 for a residential delegation.48 /
Target subnet prefix lengthThe size you want to carve the block into. /64 is the standard LAN size on IPv6 networks.64 /

It returns

  • Subnets at the target prefix — How many subnets of the target size fit inside the block.
  • First address (network)
  • Last address
  • Addresses per target subnet
  • Addresses in the whole block
  • First address, fully expanded
  • Bits borrowed for subnetting

The formula

A=2128n,S=2ba
last=first+2128n1

In plain text: addresses = 2^(128 − n); subnets from /a to /b = 2^(b − a)

  • ANumber of addresses in a prefix of length n (addresses)
  • nPrefix length of the block (bits)
  • SNumber of subnets when a /a is divided into /b blocks (subnets)
  • aPrefix length of the parent block (bits)
  • bPrefix length of each target subnet, b ≥ a (bits)

The first address of a prefix is the address with every host bit set to 0; the last is the same address with every host bit set to 1. IPv6 has no broadcast address and reserves no network address, so both endpoints are assignable on ordinary links.

Updated Category IP Addressing & Subnetting Verified against published test cases Reading time 12 min

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 ba 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.

  1. 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.
  2. Count the borrowed bits. Going from /48 to /64 fixes 64 − 48 = 16 more bits.
  3. 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.
  4. Find the first address. Clear all 80 host bits: 2001:0db8:abcd:0000:0000:0000:0000:0000, written 2001:db8:abcd:: in canonical form.
  5. 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.
  6. Size one subnet. Each /64 leaves 128 − 64 = 64 host bits, so 264 = 18,446,744,073,709,551,616 addresses per LAN.
  7. 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

How many /64 LANs each prefix length contains, and its total address space. Every figure is 2 raised to a power — /64 count is 264−n and address count is 2128−n.
PrefixHost bits/64 subnets insideTotal addressesTypical use
/32964,294,967,2967.9228 × 1028Minimum allocation to an ISP or LIR
/3692268,435,4564.9518 × 1027Regional block inside an ISP
/408816,777,2163.0949 × 1026Large enterprise, multi-region
/44841,048,5761.9343 × 1025Enterprise with many sites
/488065,5361.2089 × 1024Standard end-site allocation
/52764,0967.5558 × 1022Branch office delegation
/56722564.7224 × 1021Common residential delegation
/6068162.9515 × 1020Small delegation, tight for guest and IoT VLANs
/6464118,446,744,073,709,551,616One LAN; the SLAAC boundary
/12712Router-to-router link (RFC 6164)
/12801Loopback 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.

Frequently asked questions

How many /64 subnets are in a /48?

Exactly 65,536. Going from /48 to /64 fixes 16 more bits, and each fixed bit doubles the number of subnets, so the count is 216 = 65,536. The same arithmetic gives 256 /64s in a /56, 16 in a /60 and 4,294,967,296 in a /32. Because the answer only depends on the difference between the two prefix lengths, it is the same for every allocation of that size.

Why is /64 the standard subnet size in IPv6?

Because RFC 4291 fixes the interface identifier of most unicast addresses at 64 bits. Stateless address autoconfiguration works by joining a 64-bit prefix advertised by the router to a 64-bit identifier the host makes for itself, so the prefix has to be exactly 64 bits long for the two halves to fit. Use a longer prefix and hosts on that link must get addresses from DHCPv6 or static configuration instead.

Can I use a prefix longer than /64?

Yes, on links where no host needs autoconfiguration. RFC 6164 recommends /127 for router-to-router point-to-point links, which avoids a neighbour-discovery exhaustion attack on the link, and /128 is normal for a loopback interface or a single host route. Avoid /112 or /120 on user VLANs: the addressing works, but SLAAC does not, and some devices assume a /64 regardless of what the router advertises.

How many usable addresses does an IPv6 subnet have?

All of them. IPv6 has no broadcast address, and the all-zeros host address is the subnet-router anycast address rather than a reserved network number, so a /64 offers 264 = 18,446,744,073,709,551,616 assignable addresses. The IPv4 habit of subtracting two does not carry over. In practice the limit on a segment is the neighbour cache and the multicast behaviour of the switches, not the address count.

What does the double colon in an IPv6 address mean?

It stands in for one run of consecutive all-zero 16-bit groups, and it may appear only once in an address. RFC 5952 tightens this into a canonical rule: compress the longest such run, choose the leftmost when two runs are equally long, and never compress a run of only one group. That is why 2001:db8:0:0:0:0:0:1 becomes 2001:db8::1 while 2001:db8:0:1:1:1:1:1 stays fully written out.

Does this calculator accept an address with a prefix already attached?

Yes, but it ignores it. If you paste 2001:db8:abcd::/48 the address is read and the trailing /48 is discarded, because the prefix-length field below the address box is the authoritative one. When the two disagree the calculator says so in a note, so you can correct whichever is wrong. This avoids the ambiguity of two controls setting the same value.

What is a normal allocation to ask my ISP for?

A /48 for a business site and at least a /56 for a home connection. RFC 6177 recommends that end sites receive a prefix short enough to support multiple subnets rather than a single /64, and leaves the exact size to the operator. A /56 gives 256 LANs, which is comfortable for a home with guest, IoT and management segments; a /60 gives 16 and gets tight quickly. A single /64 cannot be subnetted at all.

Why does a /49 look wrong even though the math works?

Because it does not land on a hex digit boundary. Each hexadecimal digit is 4 bits, so prefixes that are multiples of 4 start and end at a visible character in the written address, while a /49 splits a digit in half. The arithmetic is unaffected — a /49 holds 279 addresses — but reverse DNS delegation, address plans and eyeball verification all get much harder, which is why operators allocate on nibble boundaries by convention.

Is 2001:db8:: safe to use in documentation?

Yes. 2001:db8::/32 is reserved by RFC 3849 for documentation and examples, in the same spirit as 192.0.2.0/24 in IPv4, and it is not routed on the public internet. Every example on this page uses it. For addresses that are real but private to your organisation, use a unique local prefix generated under RFC 4193 instead.

References