What is my IPv6 subnet range?
Type an IPv6 address, with or without its prefix after a slash. The IPv6 subnet calculator works like a subnet calculator for IPv4, on all 128 bits.
- Network
- 2001:db8:abcd:12::/64
The subnet 2001:db8:abcd:12::/64 holds 18,446,744,073,709,551,616 addresses (2001:db8:abcd:12:: – 2001:db8:abcd:12:ffff:ffff:ffff:ffff).
- Address range
- 2001:db8:abcd:12:: – 2001:db8:abcd:12:ffff:ffff:ffff:ffff
- Addresses
- 18,446,744,073,709,551,616
- Addresses as a power of 2
- 2^64
- /64 subnets
- 1
- Network address
- 2001:db8:abcd:12::
- Last address
- 2001:db8:abcd:12:ffff:ffff:ffff:ffff
- Full address
- 2001:0db8:abcd:0012:0000:0000:0000:0001
- Compressed address
- 2001:db8:abcd:12::1
- Address type
- Documentation
Network: 2001:db8:abcd:12::/64. The subnet 2001:db8:abcd:12::/64 holds 18,446,744,073,709,551,616 addresses (2001:db8:abcd:12:: – 2001:db8:abcd:12:ffff:ffff:ffff:ffff).
How to calculate
Computes an IPv6 subnet from an address and a prefix length: the network, the first and last address, the number of addresses and of /64 subnets, the full and compressed address, and the address type.
Example with the default inputs (IPv6 address 2001:db8:abcd:12::1, Prefix length /64): The subnet 2001:db8:abcd:12::/64 holds 18,446,744,073,709,551,616 addresses (2001:db8:abcd:12:: – 2001:db8:abcd:12:ffff:ffff:ffff:ffff).
Method: network = address AND mask, last = network OR NOT mask, where the mask has prefix leading 1 bits of 128; addresses = 2^(128 − prefix).
- The address may use any RFC 4291 text form: full, with leading zeros left out, with :: once, or with an IPv4 dotted quad as the last 32 bits.
- Results are written in the RFC 5952 form: lowercase hex, no leading zeros, :: for the longest run of two or more zero groups.
- IPv6 has no broadcast address, so every address from the first to the last is counted.
Worked examples
Each example is checked against the calculator on every build.
- IPv6 address 2001:db8:abcd:12::1, Prefix length /64 gives Network 2001:db8:abcd:12::/64, Address range 2001:db8:abcd:12:: – 2001:db8:abcd:12:ffff:ffff:ffff:ffff, Addresses 18,446,744,073,709,551,616, Addresses as a power of 2 2^64, /64 subnets 1, Full address 2001:0db8:abcd:0012:0000:0000:0000:0001, Compressed address 2001:db8:abcd:12::1, Address type Documentation.Source: RFC 4291, IP Version 6 Addressing Architecture, section 2.2 and 2.3. https://www.rfc-editor.org/rfc/rfc4291; RFC 5952, A Recommendation for IPv6 Address Text Representation, section 4. https://www.rfc-editor.org/rfc/rfc5952; RFC 3849 (2001:db8::/32 documentation prefix), https://www.rfc-editor.org/rfc/rfc3849
- IPv6 address 2001:0DB8:0000:0000:0001:0000:0000:0001/48 gives Network 2001:db8::/48, Last address 2001:db8:0:ffff:ffff:ffff:ffff:ffff, Addresses 1,208,925,819,614,629,174,706,176, /64 subnets 65,536, Compressed address 2001:db8::1:0:0:1.Source: RFC 5952, A Recommendation for IPv6 Address Text Representation, section 4. https://www.rfc-editor.org/rfc/rfc5952 (example 2001:db8::1:0:0:1: the first of two equal runs of zeros is compressed)
- IPv6 address fe80::1ff:fe23:4567:890a, Prefix length /10 gives Network fe80::/10, Last address febf:ffff:ffff:ffff:ffff:ffff:ffff:ffff, Address type Link-local unicast.Source: RFC 4291, IP Version 6 Addressing Architecture, section 2.2 and 2.3. https://www.rfc-editor.org/rfc/rfc4291 (section 2.5.6: link-local unicast is FE80::/10)
- IPv6 address 2001:db8:0:1:1:1:1:1, Prefix length /128 gives Network 2001:db8:0:1:1:1:1:1/128, Address range 2001:db8:0:1:1:1:1:1, Addresses 1, Compressed address 2001:db8:0:1:1:1:1:1.Source: RFC 5952, A Recommendation for IPv6 Address Text Representation, section 4. https://www.rfc-editor.org/rfc/rfc5952 (section 4.2.2: :: must not shorten one 16-bit 0 field; 4.2.3: the longest run is shortened)
- IPv6 address ::ffff:192.0.2.128/96 gives Network ::ffff:0:0/96, Full address 0000:0000:0000:0000:0000:ffff:c000:0280, Addresses 4,294,967,296.Source: RFC 4291, IP Version 6 Addressing Architecture, section 2.2 and 2.3. https://www.rfc-editor.org/rfc/rfc4291 (section 2.2 form 3 and 2.5.5.2, IPv4-mapped ::ffff:0:0/96)
How it works
An IPv6 address is a 128-bit number. A prefix length p (0 to 128) says how many leading bits are the network part.
- mask = p one bits followed by 128 − p zero bits
- network address = address AND mask (every host bit set to 0)
- last address = network OR (NOT mask) (every host bit set to 1)
- addresses = 2^(128 − p)
- /64 subnets = 2^(64 − p), shown only when p is 64 or less
Reading the address
The address may be typed in any text form of RFC 4291, section 2.2:
- eight groups of 1 to 4 hex digits separated by colons, in any case, with or without leading zeros (2001:0DB8:0:0:8:800:200C:417A);
- with :: once, standing for one or more zero groups (2001:db8::1);
- with the last 32 bits as an IPv4 dotted quad (::ffff:192.0.2.128); each of its four numbers is 0 to 255 with no leading zeros.
A prefix may follow a slash (2001:db8::1/48). It must be a whole number from 0 to 128 with no leading zeros. Without a slash, the Prefix length field is used (default /64). A second slash (::1/64/2) gives the prefix message below once the address itself reads. Zone indexes (%eth0) are not accepted. Any other text gives no answer, with one of these messages:
- "Enter an IPv6 address as up to eight groups of 1 to 4 hex digits separated by colons, with :: for one run of zero groups, such as 2001:db8::1."
- "Use :: only once in an address."
- "The prefix after the slash must be a whole number from 0 to 128."
The text may be up to 49 characters long, counting any spaces before and after it; those spaces are then ignored. A :: must stand for at least one zero group, so an address with eight groups and a :: has no answer.
Writing the results
Every address in the results is written in the RFC 5952 form: lowercase hex, no leading zeros in a group, and :: in place of the longest run of two or more consecutive zero groups. When two runs are equally long, the first is shortened. A lone zero group is written 0. Results are always written in hex groups, so an IPv4-mapped address shows as ::ffff:c000:280, not with a dotted quad.
- Network: the network address, a slash and p.
- Address range: the network address, a spaced en dash ( – ), and the last address; a /128 shows the one address.
- Addresses: 2^(128 − p) written in full with commas between groups of three digits.
- Addresses as a power of 2: the text 2^ followed by 128 − p, such as 2^64.
- /64 subnets: 2^(64 − p) with commas, for p from 0 to 64; not shown for longer prefixes.
- Full address: the address typed (not the network), as eight groups of exactly four lowercase hex digits.
- Compressed address: the address typed, in the RFC 5952 form.
- Address type: the first block in this list that holds the typed address:
| Block | Type |
|---|---|
| ::/128 | Unspecified |
| ::1/128 | Loopback |
| ::ffff:0:0/96 | IPv4-mapped |
| 2001:db8::/32 | Documentation |
| fe80::/10 | Link-local unicast |
| fc00::/7 | Unique local |
| ff00::/8 | Multicast |
| 2000::/3 | Global unicast |
Any other address is "Other (reserved or unassigned)".
Worked examples by hand
2001:db8:abcd:12::1 on a /64. The first four groups are the network part: 2001:db8:abcd:12. Setting the last four groups to 0 gives the network 2001:db8:abcd:12::/64, and setting them to ffff gives the last address 2001:db8:abcd:12:ffff:ffff:ffff:ffff. Addresses: 2^64 = 18,446,744,073,709,551,616, and the /64 count is 2^0 = 1. The full address is 2001:0db8:abcd:0012:0000:0000:0000:0001. It is in 2001:db8::/32, so its type is Documentation.
2001:0DB8:0000:0000:0001:0000:0000:0001/48. The groups are 2001, db8, 0, 0, 1, 0, 0, 1. Its compressed form has two runs of two zero groups; the first is shortened: 2001:db8::1:0:0:1 (the RFC 5952 example). Keeping the first 48 bits (three groups) gives 2001:db8::/48, and the last address is 2001:db8:0:ffff:ffff:ffff:ffff:ffff. Addresses: 2^80 = 1,208,925,819,614,629,174,706,176, which is 2^16 = 65,536 subnets of /64.
fe80::1ff:fe23:4567:890a on a /10. The first group fe80 is 1111 1110 1000 0000; its first 10 bits are kept, so the network is fe80::/10 and the last address is febf:ffff:ffff:ffff:ffff:ffff:ffff:ffff. Type: Link-local unicast.
2001:db8:0:1:1:1:1:1 on a /128. There is only one zero group, so no :: is used. The subnet is that one address: range 2001:db8:0:1:1:1:1:1, 1 address, no /64 count.
::ffff:192.0.2.128/96. The dotted quad is the last 32 bits: 192 = c0, 0 = 00, 2 = 02, 128 = 80, so the groups are 0, 0, 0, 0, 0, ffff, c000, 0280. Keeping 96 bits gives ::ffff:0:0/96 with 2^32 = 4,294,967,296 addresses. Type: IPv4-mapped.
Other questions people ask
How many addresses are in an IPv6 subnet?
A prefix of length p leaves 128 − p host bits, so the subnet holds 2^(128 − p) addresses. A /64 holds 2^64 = 18,446,744,073,709,551,616 addresses and a /48 holds 2^80.
How many /64 subnets are in a /48 or a /56?
A /48 holds 2^(64 − 48) = 65,536 subnets of /64, and a /56 holds 2^8 = 256. The calculator shows this count for any prefix up to /64.
How is an IPv6 address shortened?
RFC 5952 sets one short form: lowercase hex digits, no leading zeros in a group, and :: in place of the longest run of two or more zero groups (the first run if two are equally long). A single zero group stays written as 0.
Does an IPv6 subnet have a broadcast address?
No. IPv6 has no broadcast; it uses multicast instead. So the calculator lists the first and the last address of the subnet and counts every address between them.
Why is a /64 the usual subnet size?
IPv6 interface identifiers are 64 bits long for most unicast addresses (RFC 4291, section 2.5.1), and automatic address configuration (SLAAC) expects them. So a single network segment is normally a /64.
Can I type an IPv4 address inside an IPv6 address?
Yes. RFC 4291 lets the last 32 bits be written as a dotted quad, such as ::ffff:192.0.2.128. The calculator reads it and writes the results in hex groups.