IPv6 Subnet Calculator
Enter an IPv6 address with a prefix length (CIDR notation) to get the network, the first and last addresses and the total number of addresses. The address is also rewritten in its standard (RFC 5952) form.
How it is calculated
An IPv6 address has 128 bits. A prefix length n means that the leftmost n bits identify the network.
- Network address = the address with the rightmost (128 − n) bits set to 0.
- Last address = the network address with the rightmost (128 − n) bits set to 1.
- Number of addresses = 2 to the power of (128 − n).
- Number of /64 subnets = 2 to the power of (64 − n) (when n is 64 or less).
The calculation uses 128-bit whole numbers (BigInt), so there is no rounding error. Every prefix length from 0 (all addresses) to 128 (a single address) works. IPv6 has no broadcast address, so, unlike the IPv4 Subnet Calculator, this tool does not show a broadcast address or a count of usable hosts (total − 2). The range is given by its first and last addresses.
How an address is written (RFC 4291)
An IPv6 address can be written in these ways (RFC 4291, section 2.2):
- Eight groups separated by colons:
2001:db8:0:0:8:800:200c:417a. Each group is 1 to 4 hexadecimal digits, and leading zeros may be left out. - "::" in place of groups of zeros: "::" stands for one or more groups of 16 bits of zeros and can appear only once in an address. It can be at the start or the end (
2001:db8::8:800:200c:417a,::1and::). - The last 32 bits written as an IPv4 address:
::ffff:192.0.2.1(the IPv4 part has four numbers without leading zeros).
A prefix is written address/prefix-length (RFC 4291, section 2.3). The address on the left may have bits set in the host part; this tool shows the network address with the host part cleared.
Normalization (RFC 5952)
Because one address can be written in many ways, RFC 5952 defines one canonical form. The "Normalized address" in this tool follows its rules:
- Leading zeros in a group are always left out (
2001:0db8::0001becomes2001:db8::1). A group of 0000 is written as0. - "::" shortens as much as possible (
2001:db8:0:0:0:0:2:1becomes2001:db8::2:1). - "::" is not used for just one group of zeros (
2001:db8:0:1:1:1:1:1is correct, and2001:db8::1:1:1:1:1is not). - If there is a choice, the longest run of zero groups is shortened (
2001:0:0:1:0:0:0:1becomes2001:0:0:1::1). If two runs are the same length, the first one is shortened (2001:db8:0:0:1:0:0:1becomes2001:db8::1:0:0:1). - The letters a to f are written in lower case (
2001:DB8::1becomes2001:db8::1).
For an IPv4-mapped address (in the range ::ffff:0:0/96), RFC 5952 (section 5) recommends the mixed notation with the IPv4 part in decimal (::ffff:192.0.2.1). This tool shows that mixed notation only for addresses in the IPv4-mapped range, for reference.
Examples
- 2001:db8::1/64: network
2001:db8::/64, first2001:db8::, last2001:db8::ffff:ffff:ffff:ffff, 18,446,744,073,709,551,616 addresses (2^64), one /64 subnet. - 2001:db8::/32: 2^32 (4,294,967,296) /64 subnets.
- 2001:db8::1/127: two addresses (
2001:db8::and2001:db8::1). A /127 is used on point-to-point links between routers (RFC 6164). - 2001:db8::1/128: a single address.
- ::/0: all addresses (2^128).
- ::ffff:192.0.2.1/128: normalized
::ffff:c000:201, mixed notation::ffff:192.0.2.1.
The first address of a subnet
The first address of a subnet (with an interface ID of all zeros) is reserved as the Subnet-Router anycast address (RFC 4291, section 2.6.1). Every router must support it on the subnets it is attached to.
Notes
- Always enter the prefix length (for example "/64"), a whole number from 0 to 128. A number with a leading zero, such as "/064", is not accepted.
- A zone ID (the
%eth0infe80::1%eth0) and square brackets ([2001:db8::1]) are not supported. The tool does not say what kind of address it is (global, link-local and so on). - Full-width digits and symbols are converted to ordinary characters before reading.
- The example addresses are in
2001:db8::/32, the prefix reserved for documentation (RFC 3849). - To convert numbers between bases, use the Number Base Converter.
Sources and checking
The notation, normalization and reserved-address statements above were checked against the full text of these RFCs on 2026-11-01:
- RFC 4291, IP Version 6 Addressing Architecture (section 2.2 notation, 2.3 prefixes, 2.5.5.2 IPv4-mapped addresses, 2.6.1 Subnet-Router anycast).
- RFC 5952, A Recommendation for IPv6 Address Text Representation (section 4 canonical form, section 5 special addresses, section 7 prefixes).
- RFC 3849, IPv6 Address Prefix Reserved for Documentation.
- RFC 6164, Using 127-Bit IPv6 Prefixes on Inter-Router Links.
Frequently asked questions
Which address is the IPv6 broadcast address?
IPv6 has no broadcast address. What broadcast does in IPv4 is done with multicast in IPv6. This tool shows the first and last addresses of the range.
What does "::" mean?
One or more groups of 16 bits of zeros. It can be used only once in an address. In the canonical form (RFC 5952) it replaces the longest run of zero groups (the first one if two are equally long), and it is not used for a single zero group.
How many addresses are in a /64?
2^64, which is 18,446,744,073,709,551,616.
Why can the same address be written in different ways?
Leading zeros can be left out or kept, "::" can go in different places, and letters can be upper or lower case. Rewriting an address in the RFC 5952 canonical form gives the same text for the same address.