What is IPv6?
IPv6 (Internet Protocol version 6) is the newer version of the Internet Protocol. It does the same job as IPv4: it gives every device an address and carries packets from one network to another. The big change is the size of the address. An IPv4 address is 32 bits long. An IPv6 address is 128 bits long. If you have not met IP addresses before, start with What is an IP address?.
💡 In simple terms: IPv4 is like a phone system with short numbers that has run out of numbers. IPv6 is the same phone system with 39-digit numbers. It will not run out, but the numbers look difficult until you learn how to read and shorten them.
Why IPv6 exists
32 bits give about 4.3 billion IPv4 addresses. That sounded huge in the 1980s. Today, there are many more phones, laptops, servers, cameras and smart devices than that. The regional registries that hand out addresses ran out of free IPv4 blocks during the 2010s.
The internet kept growing by using workarounds. The main one is NAT (Network Address Translation): a home or office uses private addresses inside, and a router replaces them with one shared public address on the way out. Some providers even add a second layer of NAT, called carrier-grade NAT. These workarounds work, but they have a cost:
- Devices on the internet cannot start a connection to a device behind NAT without extra rules, such as port forwarding.
- Games, voice calls and peer-to-peer apps need special techniques to get through NAT.
- The NAT router must track every connection, which uses memory and makes problems harder to troubleshoot.
- Public IPv4 addresses are now bought and sold, and they are expensive.
IPv6 fixes the root problem by making the address space so large that every device can have its own globally unique address again. 2128 is about 340 undecillion, a number with 39 digits.
IPv4 and IPv6 side by side
| IPv4 | IPv6 | |
|---|---|---|
| Length | 32 bits | 128 bits |
| Written as | 4 decimal numbers with dots | 8 hex groups with colons |
| Example | 192.168.1.10 | 2001:db8:10:1::10 |
| Total addresses | About 4.3 billion | About 340 undecillion (3.4 × 10³⁸) |
| Mask style | 255.255.255.0 or /24 | Prefix length only, e.g. /64 |
| Typical LAN size | /24 (254 hosts) | /64 (about 18 quintillion addresses) |
| Broadcast | Yes | No (multicast instead) |
| Needs NAT to save addresses | Usually | No |
A quick hex refresher
IPv6 addresses are written in hexadecimal (hex), which is base 16. Normal decimal numbers use 10 digits, 0 to 9. Hex needs 16 digits, so after 9 it uses letters: a=10, b=11 and so on, up to f=15. Upper and lower case mean the same thing, but lower case is the standard way to write IPv6 addresses.
The useful fact is that one hex digit is exactly 4 bits, because 4 bits can hold 16 values (0000 to 1111). So you can convert hex into binary one digit at a time, without any calculation.
| Hex | Decimal | Binary (4 bits) |
|---|---|---|
0 | 0 | 0000 |
1 | 1 | 0001 |
2 | 2 | 0010 |
7 | 7 | 0111 |
9 | 9 | 1001 |
a | 10 | 1010 |
b | 11 | 1011 |
c | 12 | 1100 |
d | 13 | 1101 |
e | 14 | 1110 |
f | 15 | 1111 |
For example, the hex group 0db8 is the four digits 0, d, b and 8. In binary, that is 0000 1101 1011 1000, which is 16 bits.
The structure: 8 hextets of 16 bits
An IPv6 address is split into 8 groups, separated by colons. Each group has 4 hex digits. 4 digits × 4 bits = 16 bits per group, and 8 groups × 16 bits = 128 bits. One group is called a hextet (like an “octet” in IPv4, but 16 bits instead of 8).
| Hextet | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 |
|---|---|---|---|---|---|---|---|---|
| Value | 2001 | 0db8 | abcd | 0010 | 0000 | 0000 | 0000 | 0025 |
| Bits | 0–15 | 16–31 | 32–47 | 48–63 | 64–79 | 80–95 | 96–111 | 112–127 |
Written out in full, that is 2001:0db8:abcd:0010:0000:0000:0000:0025. This is long and easy to mistype, so IPv6 has two rules for shortening it.
The two shortening rules
Rule 1: drop leading zeros in each group
Inside any group, you may remove zeros at the start (the left). You may never remove zeros at the end, because they carry value, just as 50 is not the same as 5.
0db8→db80010→100025→250000→0(a group always keeps at least one digit)ff00→ staysff00(the zeros are at the end)
After rule 1: 2001:db8:abcd:10:0:0:0:25
Rule 2: replace one run of zero groups with ::
A run of groups that are all zero (two or more in a row) can be replaced by a double colon ::. Choose the longest run. If two runs are the same length, use the first one.
After rule 2: 2001:db8:abcd:10::25
Why only once? When someone reads an address with ::, they work out how many zero groups it hides by counting the groups they can see and filling the rest up to 8. With one :: there is only one answer. With two, for example 2001:db8::1::5, the 4 hidden zero groups could be split 1+3, 2+2 or 3+1, which are three different addresses. So two :: in one address is invalid.
Try it step by step
Type any IPv6 address below, in full or shortened form. The tool expands it to 8 full groups and then applies rule 1 and rule 2 one at a time, so you can see exactly what each rule does.
1Expand to the full form: 8 groups of 4 hex digits
2001:0db8:0000:0000:0000:ff00:0042:8329
2Rule 1: drop the leading zeros in each group
2001:db8:0:0:0:ff00:42:8329
Only zeros on the left of a group can go. 0db8 becomes db8, but ff00 stays ff00.
3Rule 2: replace the longest run of zero groups with :: (once)
Groups 3 to 5 (3 zero groups) become ::. Any other zero group stays as a single 0.
Shortest correct form
2001:db8::ff00:42:8329
Worked example: compressing
Shorten 2001:0db8:0000:0000:0001:0000:0000:0001.
2001:db8:0:0:1::1 is also valid and means the same address. However, the standard form (RFC 5952, the rule book for writing IPv6 addresses as text) says to choose the first run when there is a tie. Tools and logs follow this rule, so learning it helps you match what you see on screen.
Worked example: expanding
Expand 2001:db8:5::a:1 back to the full form.
Two more quick ones to test yourself:
| Short form | Full form |
|---|---|
::1 | 0000:0000:0000:0000:0000:0000:0000:0001 |
fe80::1 | fe80:0000:0000:0000:0000:0000:0000:0001 |
2001:db8:: | 2001:0db8:0000:0000:0000:0000:0000:0000 |
Prefix notation: /64, /48, /56
IPv6 has no dotted subnet mask like 255.255.255.0. It uses only the prefix length: a slash followed by the number of bits that belong to the network. You already know this idea from Subnet mask basics: in IPv4, /24 means the first 24 bits are the network.
2001:db8:abcd:10::25/64 means that the first 64 bits (the first 4 hextets, 2001:db8:abcd:10) are the network, and the rest identify this one interface. The network itself is written with the host part set to zero: 2001:db8:abcd:10::/64.
💡 Shortcut: every hextet is 16 bits, so /16, /32, /48 and /64 end exactly at a colon: /48 is the first 3 hextets and /64 is the first 4. A /56 ends in the middle of the 4th hextet (after its first 2 hex digits).
Network part and interface ID
On almost every IPv6 LAN, the 128 bits are split exactly in half:
- The network prefix (first 64 bits): the same for every device on that subnet. It is set by the router or the network administrator.
- The interface ID (last 64 bits): unique for each device on the subnet. It plays the role of the “host part” in IPv4. Devices can even create it themselves, as the next lesson shows.
Learn more: IPv6 Address Types and Autoconfiguration
How addresses are handed out
IPv6 blocks are handed down in layers. Each layer takes a large block and divides it into smaller ones for the next layer:
Here is the same address, drawn as its 128 bits in rows of 32:
How many /64 subnets fit in a /48?
A /48 fixes 48 bits, and a subnet is a /64. You can use the 16 bits between them (64 − 48) to number your subnets. 216 = 65,536 subnets. In practice, that is the 4th hextet, which can go from 0000 to ffff.
| Subnet ID | Subnet | Could be used for |
|---|---|---|
0010 | 2001:db8:abcd:10::/64 | VLAN 10, staff PCs |
0020 | 2001:db8:abcd:20::/64 | VLAN 20, phones |
0030 | 2001:db8:abcd:30::/64 | VLAN 30, servers |
ffff | 2001:db8:abcd:ffff::/64 | The last of the 65,536 |
Many administrators match the subnet ID to the VLAN number, as above, so the address itself tells you which VLAN a device is on.
/32 · Internet provider (ISP)
A typical block that a regional registry gives a provider. Example: 2001:db8::/32.
Holds: 65,536 /48s
/48 · One customer site
A company office or campus. Example: 2001:db8:abcd::/48.
Holds: 65,536 /64s
/56 · One home
Many providers give homes a /56 instead of a /48. Example: 2001:db8:abcd:ab00::/56.
Holds: 256 /64s
/64 · One subnet (one LAN or VLAN)
The standard size for a network with hosts on it. Example: 2001:db8:abcd:10::/64.
Holds: 2⁶⁴ addresses
To split a prefix yourself, use the IPv6 Subnet Calculator. It shows the network, the address range and the number of subnets for any prefix.
No broadcast in IPv6
IPv4 has a broadcast address in every subnet (for example, 192.168.1.255) that reaches every device, whether the message is relevant to it or not. IPv6 has no broadcast at all. It uses multicast instead: a message is sent to a group address, and only devices that have joined that group listen. This means less unnecessary traffic for every device on the LAN.
One useful side effect: because there is no broadcast address, IPv6 has no “minus two” rule when you count usable addresses. (The all-zeros interface ID is reserved for routers, but in a /64 with 264 addresses that makes no practical difference.)
Dual stack: IPv4 and IPv6 together
The internet cannot switch to IPv6 overnight. Most networks today run dual stack: every device and router runs IPv4 and IPv6 at the same time, with an address of each kind. When your browser looks up a website in DNS, it asks for both an IPv4 address (an A record) and an IPv6 address (an AAAA record). If both exist, modern systems usually try IPv6 first and quickly fall back to IPv4 if IPv6 is slow or fails.
Seeing your IPv6 address
On Windows, ipconfig shows the IPv6 lines next to the IPv4 ones:
C:\> ipconfig Ethernet adapter Ethernet: Connection-specific DNS Suffix . : home.arpa IPv6 Address. . . . . . . . . . . : 2001:db8:abcd:10::25 Link-local IPv6 Address . . . . . : fe80::1c2a:3bff:fe4d:5e6f%12 IPv4 Address. . . . . . . . . . . : 192.168.10.25 Subnet Mask . . . . . . . . . . . : 255.255.255.0 Default Gateway . . . . . . . . . : fe80::1%12 192.168.10.1
fe80:: lines are link-local addresses, and %12 is Windows' number for this network card. Both are explained in the next lesson.On Linux, use ip -6 -brief address for a one-line summary per interface:
$ ip -6 -brief address lo UNKNOWN ::1/128 eth0 UP 2001:db8:abcd:10::25/64 fe80::1c2a:3bff:fe4d:5e6f/64
eth0 is UP and has a global address (2001:db8:abcd:10::25) and a link-local address (fe80::…). The /64 after each address is the prefix length: the first 4 hextets are the network.When it goes wrong
| Symptom | Likely cause | What to check |
|---|---|---|
The device shows only an fe80:: address | No router is advertising an IPv6 prefix on this LAN | The router's IPv6 settings; see the next lesson on autoconfiguration |
| A configuration is rejected as “invalid address” | :: used twice, or a group with 5 digits | Expand the address by hand to 8 groups of 4 digits |
| Two devices on one LAN can't reach each other over IPv6 | They were given different prefixes, or a prefix other than /64 | Compare the first 4 hextets and the prefix length |
| Websites are slow to start loading, then work | IPv6 is partly broken; the browser waits, then falls back to IPv4 | ping -6 a known IPv6 host and check the provider's IPv6 status |
Common mistakes
- Removing zeros from the end of a group.
ff00is notff; only leading zeros can be removed. - Using :: twice. The address becomes ambiguous, so it is invalid.
- Forgetting the hidden groups when expanding. Always count them: the total must be 8 groups.
- Carrying over IPv4 habits, such as giving a LAN a /120 to “save addresses”. LANs with hosts should be /64, or automatic addressing (SLAAC) will not work.
- Thinking IPv6 has a broadcast address. It has none; it uses multicast instead.
- Using real addresses in documentation and labs. They may belong to someone else. Use
2001:db8::/32, which is reserved for examples.
- IPv6 exists because IPv4's 4.3 billion addresses have run out; NAT is only a workaround.
- An IPv6 address is 128 bits: 8 hextets of 4 hex digits, separated by colons.
- Shorten with two rules: drop leading zeros, and replace the longest run of zero groups with :: (only once).
- Prefixes are written as /length. A LAN is a /64, a site usually gets a /48 and a home often gets a /56.
- The first 64 bits are the network prefix; the last 64 bits are the interface ID.
- A /48 holds 65,536 /64 subnets (16 bits of subnet ID).
- IPv6 has no broadcast. Most networks run dual stack: IPv4 and IPv6 together.
Check yourself
You need to type 2001:0db8:0000:0000:0000:0000:0000:0100 into a router. What is its shortest correct form?
A router rejects the address 2001:db8::5::1. Why is it not valid?
Your company receives 2001:db8:abcd::/48. How many /64 subnets can you make?
A server has the address 2001:db8:abcd:10::25/64. Which part is the interface ID?
A PC on a dual-stack network opens a website that has both A and AAAA records. What usually happens?
Next, learn what each type of IPv6 address does (link-local, multicast and more) and how devices give themselves an address.
Learn more: IPv6 Address Types and Autoconfiguration