Skip to content
Subnet Math

IPv6 subnet calculator

Enter an IPv6 address in full or shortened form and a prefix length from 0 to 128. You get the network prefix, the first and last address of the range in both short and expanded form, the exact number of addresses and how many /64 subnets the prefix holds.

Full or shortened form, for example 2001:db8:abcd:12::1 or 2001:db8:abcd:12::1/64.

For example 64 or /48.

Example: 2001:db8:abcd:12::/64

The prefix holds 18,446,744,073,709,551,616 addresses or 1 subnet of /64

Network prefix 2001:db8:abcd:12::/64
First address 2001:db8:abcd:12::
Last address 2001:db8:abcd:12:ffff:ffff:ffff:ffff
First address, expanded 2001:0db8:abcd:0012:0000:0000:0000:0000
Last address, expanded 2001:0db8:abcd:0012:ffff:ffff:ffff:ffff
Address you entered, expanded 2001:0db8:abcd:0012:0000:0000:0000:0001
Prefix length /64
Total addresses 18,446,744,073,709,551,616
Subnets of /64 1

This is address arithmetic from the IPv4 and IPv6 standards. It shows how a block divides up; it does not plan, configure or protect a network.

IPv6 has no broadcast address, so the last address of the prefix is an ordinary address. The total counts every address in the prefix.

The formula, with a worked example

Reading an IPv6 address

An IPv6 address is 128 bits long, four times the length of an IPv4 address. It is written as eight groups of four hexadecimal digits separated by colons, for example 2001:0db8:abcd:0012:0000:0000:0000:0001. Two shortening rules make it easier to read. Leading zeros in a group can be dropped, so 0db8 becomes db8 and 0012 becomes 12. And one run of groups that are all zero can be replaced with a double colon, so the address above becomes 2001:db8:abcd:12::1.

The double colon can only appear once, because otherwise there would be no way to tell how many zero groups each one stands for. The calculator accepts either form and shows its answers both ways: the short form defined in RFC 5952, and the expanded form with all 32 hex digits, which is easier to line up when you compare addresses.

How the prefix splits the address

The prefix length works exactly as it does in IPv4: it counts how many bits from the left are the network part. Because each hex digit is 4 bits, prefixes that are multiples of 4 fall on a digit boundary and multiples of 16 fall on a group boundary. A /48 keeps the first three groups, a /56 keeps the first three groups and two digits of the fourth, and a /64 keeps the first four groups.

Take 2001:db8:abcd:12ff::/56. The first 56 bits are 2001:0db8:abcd:12, the next 8 bits (ff) belong to the host part, so the network is 2001:db8:abcd:1200::/56. Its last address sets every one of the remaining 72 bits to 1: 2001:db8:abcd:12ff:ffff:ffff:ffff:ffff. The prefix holds 2^72 = 4,722,366,482,869,645,213,696 addresses, or 256 subnets of /64 each.

When a prefix does not fall on a digit boundary, say a /61, the split happens inside a hex digit. Convert that one digit to its four bits, keep the bits the prefix covers and zero the rest. The calculator does this for any prefix from 0 to 128.

Why the /64 count matters

In IPv6 the /64 is the usual size of a single subnet, the size most address auto-configuration expects. So the useful question about a larger prefix is often not how many addresses it has, which is always enormous, but how many /64 subnets fit inside it. That number is 2^(64 − prefix). A /48 holds 65,536 subnets of /64, a /52 holds 4,096, a /56 holds 256 and a /60 holds 16.

The address counts are exact. The calculator works them out digit by digit rather than with floating-point numbers, so a /32 shows all 29 digits of 79,228,162,514,264,337,593,543,950,336 instead of a rounded figure.

Edge cases: /127, /128 and no broadcast

IPv6 has no broadcast address. The job broadcast does in IPv4 is done by multicast, so the last address of a prefix is an ordinary address and nothing is subtracted from the count. That is why this page shows a total and a range rather than a usable host count with two taken away.

A /127 holds exactly two addresses, and RFC 6164 describes using it on point-to-point links, much like an IPv4 /31. A /128 is a single address. Both are shown with their real counts of 2 and 1.

The documentation prefix 2001:db8::/32 (RFC 3849) is reserved for examples like the ones on this page, so they never point at a real network.

Reference: IPv6 prefix sizes

Prefix Subnets of /64 Total addresses
/32 4,294,967,296 79,228,162,514,264,337,593,543,950,336
/40 16,777,216 309,485,009,821,345,068,724,781,056
/44 1,048,576 19,342,813,113,834,066,795,298,816
/48 65,536 1,208,925,819,614,629,174,706,176
/52 4,096 75,557,863,725,914,323,419,136
/56 256 4,722,366,482,869,645,213,696
/60 16 295,147,905,179,352,825,856
/64 1 18,446,744,073,709,551,616
/72 – 72,057,594,037,927,936
/80 – 281,474,976,710,656
/96 – 4,294,967,296
/112 – 65,536
/120 – 256
/124 – 16
/126 – 4
/127 – 2
/128 – 1

Frequently asked questions

How many addresses are in a /64?

2^64, which is 18,446,744,073,709,551,616 addresses. IPv6 has no broadcast address, so none are taken away.

How many /64 subnets are in a /48?

65,536. A /48 leaves 16 bits between the prefix and the /64 boundary, and 2^16 = 65,536.

How many /64 subnets are in a /56?

256. A /56 leaves 8 bits before the /64 boundary, and 2^8 = 256.

What does :: mean in an IPv6 address?

It stands for one run of groups that are all zero. 2001:db8::1 is 2001:0db8:0000:0000:0000:0000:0000:0001 in full. It can appear only once in an address.

Does IPv6 have a broadcast address?

No. IPv6 uses multicast instead, so the last address of a prefix is an ordinary address and the address count is the full 2^(128 − prefix).

What is 2001:db8::/32?

The IPv6 prefix reserved for documentation by RFC 3849. Examples use it so they never point at a real network, the same way 192.0.2.0/24 is used for IPv4.

Working with IPv4 too? The IPv4 subnet calculator gives the network, broadcast and usable host range for any address and mask. IPv4 subnet calculator

Other subnet tools on this site