Skip to main content
Loading time...

IPv4 vs IPv6: Key Differences and Migration Guide

A practical guide to the two versions of the Internet Protocol -- what changed, why it matters, and how the transition works.

The Address Exhaustion Problem

IPv4, defined in 1981 by RFC 791, uses 32-bit addresses. That gives the entire internet a theoretical maximum of 232 addresses -- about 4.3 billion. That seemed like plenty when the internet was a research project connecting a few hundred universities. It did not remain plenty for long.

The Internet Assigned Numbers Authority (IANA) allocated the last blocks of IPv4 addresses to the five Regional Internet Registries in February 2011. Most RIRs have since exhausted their pools. Today, new IPv4 addresses are only available through transfers (buying them from other organizations) at prices that can exceed $50 per address.

IPv6, defined in 1998 by RFC 2460, uses 128-bit addresses. That provides approximately 3.4 x 1038 addresses -- enough to assign a unique address to every atom on the surface of the earth and still have addresses left over. This was a deliberate design decision: IPv6 was built to never run out.

Address Format Comparison

The most visible difference between IPv4 and IPv6 is how addresses look:

Address Formats

IPv4 (32-bit, dotted decimal)
192.168.1.1
11000000.10101000.00000001.00000001
IPv6 (128-bit, colon-separated hex)
2001:0db8:85a3:0000:0000:8a2e:0370:7334
Compressed: 2001:db8:85a3::8a2e:370:7334

IPv4 addresses use four 8-bit numbers (0-255) separated by dots. IPv6 addresses use eight groups of four hexadecimal digits separated by colons. IPv6 allows compression: leading zeros in a group can be omitted, and the longest consecutive run of all-zero groups can be replaced with :: (but only once per address).

Key Technical Differences

FeatureIPv4IPv6
Address size32 bits (4 bytes)128 bits (16 bytes)
Address space~4.3 billion~3.4 x 1038
Header size20-60 bytes (variable)40 bytes (fixed)
NAT required?Usually (address scarcity)No (end-to-end connectivity)
BroadcastYesNo (multicast instead)
IPsecOptionalBuilt-in (mandatory support)
Auto-configurationDHCPSLAAC + DHCPv6
FragmentationRouters and senderSender only (Path MTU Discovery)

NAT and End-to-End Connectivity

One of the most significant practical differences is how devices connect to each other. Because IPv4 addresses are scarce, most networks use Network Address Translation (NAT): multiple devices share a single public IP address, and the NAT device translates between private internal addresses and the shared public address.

NAT breaks the original end-to-end principle of the internet. It makes peer-to-peer connections difficult (think of the hoops WebRTC goes through with STUN/TURN servers), complicates running servers behind a home connection, and adds complexity to protocols that embed IP addresses in their payloads (like SIP for VoIP).

IPv6 has enough addresses that every device can have its own globally unique address. This restores end-to-end connectivity: any device can communicate directly with any other device without NAT in the middle. This simplifies protocol design, improves performance (no NAT translation overhead), and enables new use cases like direct device-to-device communication in IoT.

IPv6 Address Types

IPv6 defines several address scopes that developers and network engineers should understand:

  • Global Unicast (2000::/3): The equivalent of public IPv4 addresses. Globally routable and unique. Most internet-facing IPv6 addresses start with 2 or 3.
  • Link-Local (fe80::/10): Auto-configured on every IPv6 interface. Only valid on the local network segment. Used for neighbor discovery and router solicitation. Every IPv6 device has one, even without any other configuration.
  • Unique Local (fc00::/7): The IPv6 equivalent of RFC 1918 private addresses. Routable within a site but not on the global internet. In practice, most networks use the fd00::/8 subset with randomly generated prefixes.
  • Multicast (ff00::/8): Replaces IPv4 broadcast. Packets are delivered to all members of a multicast group. IPv6 has no broadcast -- even “all nodes on the link” uses multicast address ff02::1.
  • Loopback (::1): The IPv6 equivalent of 127.0.0.1. A single address, not an entire /8 block like IPv4.

Migration Strategies

The transition from IPv4 to IPv6 has been gradual -- and is still ongoing decades after IPv6 was standardized. Three main strategies enable coexistence:

Dual Stack

The most common approach: devices and servers run both IPv4 and IPv6 simultaneously. Each interface has both an IPv4 address and one or more IPv6 addresses. Applications prefer IPv6 when available (Happy Eyeballs / RFC 6555) and fall back to IPv4. All major operating systems, cloud providers, and CDNs support dual stack today.

Tunneling (6in4, 6to4, Teredo)

IPv6 packets are encapsulated inside IPv4 packets to traverse IPv4-only networks. This was important in the early transition but is being phased out as native IPv6 connectivity becomes widespread. Tunneling adds overhead and can cause performance issues.

Translation (NAT64/DNS64)

Allows IPv6-only clients to access IPv4-only servers. A NAT64 gateway translates between the two protocols. DNS64 synthesizes AAAA records for domains that only have A records. This is increasingly used by mobile carriers that run IPv6-only networks.

Implications for Developers

If you write software that handles IP addresses, here is what you need to know:

  • Never hardcode IPv4 assumptions. Do not store IPs in 32-bit integers, do not assume addresses match \d+\.\d+\.\d+\.\d+, and do not assume addresses will fit in 15 characters. Use address family-agnostic APIs.
  • Test with both protocols. Use ::1 for local IPv6 testing. Many CI environments have IPv6 enabled.
  • Use square brackets for IPv6 in URLs. An IPv6 literal in a URL must be wrapped in brackets: http://[2001:db8::1]:8080/path. This is easy to forget and causes confusing parse errors.
  • Watch for IPv4-mapped IPv6 addresses. In dual-stack environments, IPv4 connections often arrive as ::ffff:192.168.1.1. Your code needs to handle this format when parsing client IPs.

Try It Yourself

Use our IP Address Lookup tool to analyze both IPv4 and IPv6 addresses. The Formats tab shows how any address looks in decimal, hex, binary, and other representations. Try entering 2001:db8::1 to see a fully expanded IPv6 address, or 192.168.1.1 to explore a familiar IPv4 address.

Further Reading