The core difference in IPv4 vs IPv6 is address size: an IPv4 address is 32 bits long and written as four numbers, like 192.0.2.1, while an IPv6 address is 128 bits long and written in hexadecimal groups, like 2001:db8::1. IPv4 allows about 4.3 billion addresses; IPv6 allows about 340 undecillion (3.4 × 10³⁸).
Both are versions of the Internet Protocol, the rules that give every device an IP address and carry its data across networks. IPv6 was built because IPv4 was running out of addresses, and it also changes how devices get an address and how each packet is labeled. The two versions can't talk to each other directly, so devices and services often run both side by side, which is called dual stack. On October 27, 2026, 46.8% of users who reached Google did so over IPv6.
TL;DR
Neither IPv4 nor IPv6 is faster or more secure by design. What differs in practice is how many addresses exist and how they behave in your network, logs, and rules.
- The encryption framework often credited to IPv6, IPsec, is recommended rather than required in IPv6 and available to IPv4 too; how safe a network is depends on how its firewall and applications are set up.
- IPv6's basic packet header is 40 bytes, 20 more than IPv4's smallest, but it has fewer fields and never changes size.
- One IPv6 home or business often gets a whole block of addresses, and devices can switch addresses daily, so rules that track single IPv4 addresses must track blocks for IPv6.
- IPv6 keeps growing without replacing IPv4: APNIC Labs measured 43.8% of users worldwide as IPv6-capable in October 2026, up from 41.8% a year earlier.
IPv4 vs IPv6 at a glance
Row by row, here is the difference between IPv4 and IPv6, from the address itself to what a provider hands a customer. The /24, /64, and /48 near the end are prefix lengths: how many leading bits all the addresses in a block share, so a bigger number means a smaller block.
| Difference | IPv4 | IPv6 |
|---|---|---|
| Address length | 32 bits | 128 bits |
| Possible addresses | 4,294,967,296 (2³²) | About 3.4 × 10³⁸ (2¹²⁸) |
| Written as | Four decimal numbers from 0 to 255, separated by dots | Eight groups of up to four hexadecimal digits, separated by colons; one run of zero groups can shrink to :: |
| Example (documentation ranges) | 192.0.2.1 |
2001:db8::1 |
| Packet header (the label routers read) | 20 to 60 bytes, depending on options | 40 bytes, fixed; optional extras go in separate extension headers |
| Header checksum | Yes | No |
| Who splits packets that are too big | The sender and routers along the path | Only the sender |
| Finding other devices on the local network | ARP, a separate protocol | Neighbor Discovery, part of IPv6 |
| Getting an address automatically | A DHCP server assigns one | The device builds its own (SLAAC), or a DHCPv6 server assigns one |
| Sending to every device on a network | Broadcast | No broadcast; multicast instead |
| IPsec (IP-layer encryption) support | Optional | Recommended, not required |
| DNS record | A | AAAA |
| Loopback address | 127.0.0.1 |
::1 |
| Private or local-only ranges | 10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16 |
fc00::/7 (unique local addresses) |
| Typical local network | Often a /24 (256 addresses) | A /64 |
| What one home or business gets | One public address, often shared with others | A block, from a /64 up to a /48 (RIPE-690 recommends a /48 or /56) |
Two rows run against common belief: the IPv6 header is bigger than IPv4's, not smaller, and IPsec is optional in practice in both versions.
How the two address formats differ
An IPv4 address has exactly one correct spelling. An IPv6 address has many, and that's the first thing that trips up people used to IPv4.
IPv6 writes 128 bits as eight groups of four hexadecimal digits (0 to 9 and a to f), separated by colons. Two rules shorten it:
- Drop the leading zeros inside any group:
0db8becomesdb8, and0000becomes0. - Replace one run of all-zero groups with
::. You can use::only once per address, or the reader couldn't tell how many zeros each one hides (RFC 4291).
So 2001:0db8:0000:0000:0000:0000:0000:0001, 2001:DB8:0:0:0:0:0:1, and 2001:db8::1 are all the same address. RFC 5952 shows eight spellings of one address as examples, then recommends a single output form (lowercase, no leading zeros, :: on the longest run of zeros) while requiring every system to accept all the others.

Two more forms show up in logs and URLs. An IPv4-mapped address, such as ::ffff:192.0.2.1, is an IPv4 address written in IPv6 form; software that handles both versions uses it when an IPv4 client connects to a program listening for IPv6. And because the colons collide with port numbers, an IPv6 address in a URL goes in brackets, as in [2001:db8::1]:443.
Blocks use the same slash notation in both versions. 2001:db8::/32 means every address whose first 32 bits match 2001:db8. That block is reserved for examples, like 192.0.2.0/24 in IPv4; the guide to reserved and bogon ranges in both versions lists the rest.
How many addresses does each version have?
IPv4 has 2³², or 4,294,967,296, possible addresses. IPv6 has 2¹²⁸, which is 340,282,366,920,938,463,463,374,607,431,768,211,456, or about 340 undecillion: roughly 7.9 × 10²⁸ times as many.
That number is real but misleading, because nobody hands out IPv6 addresses one at a time. A single local network in IPv6 is a /64, which holds 2⁶⁴ addresses, about 18.4 quintillion. Providers give customers whole blocks of those networks: a /56 contains 256 of them and a /48 contains 65,536.
IPv4 has the opposite problem. The central pool that IANA hands out to the regional internet registries ran dry on February 3, 2011, and the IP address guide covers how each registry's own pool has run down since.
What changed inside the packet
Every packet starts with a header, the label routers read to deliver it. Many comparisons say IPv6 shrank that header. It didn't: an IPv4 header is 20 bytes at minimum and can grow to 60 with options, while an IPv6 header is always 40 bytes, which the IPv6 specification notes is 20 bytes longer than IPv4's smallest.
The difference is in the layout: the IPv6 header has fewer fields and a fixed size, and anything optional moves into extension headers that follow it only when needed. Three IPv4 jobs disappeared from the main header:
- The header checksum. IPv6 leaves error checking to the layers above it; TCP and UDP checksums also cover the source and destination addresses.
- Splitting packets in transit. In IPv4, a router can break a packet that's too big for the next link into fragments. In IPv6, only the sender splits packets, so the standard guarantees that every IPv6 link carries packets of at least 1,280 bytes, a size any sender can rely on.
- Options in the header. They became optional extension headers, chained one after another.
IPv6 added one field, a 20-bit flow label, which lets a sender mark packets that belong to the same stream.

The local network works differently too. IPv6 has no broadcast; multicast does that job (how broadcast, multicast, and anycast differ). Neighbor Discovery replaces ARP, the IPv4 protocol that maps addresses to devices, and also takes over finding routers. And a device can build its own address from the network's prefix with stateless address autoconfiguration (SLAAC), so no server has to assign one, though DHCPv6 still exists for networks that want central control.
Is IPv6 faster, more secure, or better?
None of the three is true by design: each answer depends on the network and how it's run.
1. Is IPv6 faster than IPv4?
Not inherently. Speed depends on the path packets take and the equipment along it, and the two versions often take different paths between the same two machines.
A peer-reviewed study of home connections shows how much that varies. Researchers ran more than 87,000 back-to-back speed tests over both versions from about 46 homes in Chicago and Milwaukee; in up to 18% of the measurements, the two protocols differed by more than 5% in throughput, and the gaps were often tied to the internet provider (FLOTO's summary of the study).
Browsers and operating systems hide most of this. Under the Happy Eyeballs method (RFC 8305), a device asks DNS for both address types, tries IPv6 first, and starts an IPv4 attempt if IPv6 hasn't connected after a short delay, with 250 milliseconds suggested as a default. A broken IPv6 path then shows up as a small delay rather than a failure, which also makes it easy for network operators to miss.
2. Is IPv6 more secure than IPv4?
Neither version is more secure by design; firewall rules, patching, and monitoring decide how secure a network is. It helps to separate what each protocol supports from what a network has actually switched on.
IPsec, the framework for encrypting and authenticating traffic at the IP layer, was once mandatory for every IPv6 device to implement. The current IPv6 node requirements (RFC 8504, 2019) make it a recommendation, and IPv4 can use IPsec too. Supporting IPsec also doesn't mean using it: traffic is encrypted only when someone sets up IPsec, or when an application encrypts it itself, as HTTPS does with TLS.
The address-sharing in IPv4 home routers (NAT) feels like protection because outside machines can't reach inside devices directly. But NAT is a way to share one address, not a security control; a firewall can block unrequested incoming connections to IPv6 devices just as well (APNIC's blog on IPv6 security myths makes the same point). The same post notes that a /64 is far too large to scan address by address, yet scanners still find hosts with predictable addresses such as ::1 and ::2.
Most modern operating systems turn IPv6 on by default, so a network can carry IPv6 traffic even where nobody deployed it on purpose, and it needs IPv6 firewall rules as much as IPv4 ones.
3. So which one should you use?
Both, in nearly every case. Users and services on one version can't reach the other without translation in between, so anything you build or host should answer on IPv4 and IPv6. Test IPv6 as seriously as IPv4: check that your site has an AAAA record and loads over IPv6, and that your logs, rate limits, and allowlists handle IPv6 addresses.
At home, leave IPv6 on: turning it off is a troubleshooting step, not a speed or security setting.
Why IPv4 is still everywhere
IPv4's central pool ran dry in 2011, yet most of the internet still runs on it, largely because of address sharing.
At home, a router gives every device a private address from ranges reserved for that use (RFC 1918 sets aside 10.0.0.0/8, 172.16.0.0/12, and 192.168.0.0/16) and shares one public address among them. Many providers then do the same thing one level up: with carrier-grade NAT, one public address serves many customers, who sit in a shared range, 100.64.0.0/10, set aside for exactly that (RFC 6598). Sharing stretched IPv4 a long way, at the cost of the direct addressing IPv6 restores: with IPv6, every device can have its own public address, and a firewall decides what reaches it.
The two versions coexist in two ways. With dual stack, a website publishes an A record for its IPv4 address and an AAAA record for its IPv6 address, and devices with both kinds of connectivity pick one per connection. Networks that run IPv6 only reach IPv4-only sites through a translator called NAT64, so their users arrive at an IPv4-only server from the translator's address.
In the United States, 55.0% of users reached Google over IPv6 on October 27, 2026 (Google's IPv6 statistics), and APNIC Labs measured 43.8% of users worldwide as IPv6-capable over the 30 days to October 26, 2026, up from 41.8% a year earlier. At about two points a year, IPv4 isn't going away soon, so plan for both for years.
What changes when your code handles IPv6
Code written for IPv4 tends to break on IPv6 in five predictable places.
- Parse addresses with a library, and compare the parsed values. A regular expression written for IPv4 rejects valid IPv6, and comparing text misses the many spellings of one address. This applies wherever the address comes from, including headers set by a proxy (see reading the real client IP behind a proxy).
- Store both versions in one field that fits 16 bytes. An IPv4 address is 4 bytes and an IPv6 address is 16, so a 16-byte binary column (or your database's native IP type, if it has one) holds either. In a fixed 16-byte column, store IPv4 in its mapped form (
::ffff:a.b.c.d), which keeps every value the same size and marks the version. As text, an IPv6 address needs up to 39 characters, or 45 when an IPv4-mapped address is written with a dotted IPv4 part. An integer column sized for IPv4 can't hold IPv6 at all; it needs 128 bits (convert an IP address to an integer to see both). - Unwrap IPv4-mapped addresses. If your server listens on IPv6, an IPv4 visitor can arrive as
::ffff:203.0.113.45. Turn it back into203.0.113.45before you log it, look it up, or compare it, or one visitor ends up with two identities. - Don't rate-limit or block IPv6 by single address alone. Devices that use temporary addresses (random addresses kept for privacy and replaced regularly) move to a new one inside the same /64 about once a day under the standard's defaults (RFC 8981), so counting single addresses lets one client look like many. Start at the /64, and widen to a /56 or /48 only when abuse spreads across that wider block: RIPE-690 advises providers to give each customer a /48 or /56, but providers differ, and a /48 can also be a whole company or campus. Check what a block belongs to before blocking it; the IPv6 CIDR calculator shows any block's range. IPv4 has the opposite problem: one address behind carrier-grade NAT can be many customers, so blocking it can hit people who did nothing.
- Treat a dual-stack visitor's two addresses as two records. The same person can reach you over IPv6 on one request and IPv4 on the next, from two unrelated blocks, so each address gets its own lookup; enriching IPv4 and IPv6 addresses in bulk covers doing that across your logs.

Steps 1, 3, and 4 fit in a few lines of Python's standard library. This function accepts any valid spelling, unwraps mapped addresses, and returns a key you can rate-limit on: the address itself for IPv4, and the surrounding /64 for IPv6.
import ipaddress
from typing import Optional, Union
IPAddress = Union[ipaddress.IPv4Address, ipaddress.IPv6Address]
def parse_ip(raw: Optional[str]) -> Optional[IPAddress]:
"""Parse any valid IPv4 or IPv6 spelling; return None for anything else."""
if not raw:
return None
try:
addr = ipaddress.ip_address(raw.strip())
except ValueError:
return None # not an IP address: log it upstream instead of storing it
# Dual-stack servers can report IPv4 clients as ::ffff:a.b.c.d.
# Unwrap them so one client always has one form.
if addr.version == 6 and addr.ipv4_mapped is not None:
return addr.ipv4_mapped
return addr
def limit_key(addr: IPAddress, ipv6_prefix: int = 64) -> str:
"""Key for rate limits: the IPv4 address, or the IPv6 prefix around the address."""
if addr.version == 4:
return str(addr)
# A device can change its address inside its /64, so count the prefix.
# Widen ipv6_prefix (56, 48) only when the network and the abuse call for it.
return str(ipaddress.IPv6Network((addr.packed, ipv6_prefix), strict=False))
for raw in [
"2001:0DB8:0000:0000:0000:0000:0000:0001",
"2001:db8::1",
"::ffff:192.0.2.1",
"2001:db8:4a2:10:5d1a:9be0:7f3c:4e21",
"not-an-ip",
]:
addr = parse_ip(raw)
if addr is None:
print(f"{raw}: not an IP address")
continue
print(f"{raw} -> {addr} (IPv{addr.version}), limit key {limit_key(addr)}")
Run on Python 3.10, it prints:
2001:0DB8:0000:0000:0000:0000:0000:0001 -> 2001:db8::1 (IPv6), limit key 2001:db8::/64
2001:db8::1 -> 2001:db8::1 (IPv6), limit key 2001:db8::/64
::ffff:192.0.2.1 -> 192.0.2.1 (IPv4), limit key 192.0.2.1
2001:db8:4a2:10:5d1a:9be0:7f3c:4e21 -> 2001:db8:4a2:10:5d1a:9be0:7f3c:4e21 (IPv6), limit key 2001:db8:4a2:10::/64
not-an-ip: not an IP address
The first two lines are one address in two spellings, and they produce one key. The mapped address comes back as plain IPv4, and the last IPv6 address shares its /64 key with any other address that device rotates to. If parse_ip returns None for an address you expected to pass, check whether a port or brackets are still attached ([2001:db8::1]:443) and strip them first.
What IP data looks like for each version
Both versions return the same kinds of data attached to an IP address, but the addresses behind them behave differently, and a dual-stack visitor reaches you under one of each.

Location works around a limit every provider of IP geolocation shares. When one public IPv4 address stands for many customers behind carrier-grade NAT, a lookup finds the provider's equipment, not the person, as RFC 6598 notes. An IPv6 address usually sits inside one customer's block instead. IPGeolocation.io keeps location data for ranges in both versions, so an IPv6 address a device switched to this morning still gets its range's location, and the connection type, ASN, and company returned with it show when an address belongs to a mobile or ISP network, where sharing is common.
Risk signals call for the same thinking in blocks. When you act on security data for IPv6 traffic, look at the surrounding /64 as well as the exact address, which may be only a day old.
Ownership and routing data show the clearest difference, even for a single server. The American Registry for Internet Numbers publishes two IPv4 and two IPv6 addresses for www.arin.net. Looked up through our API on October 29, 2026, one of each returned:
| Field | 199.43.0.47 |
2001:500:4:201::47 |
|---|---|---|
| Location | Centreville, Virginia, United States | Centreville, Virginia, United States |
| ASN | AS10745, ARIN Operations | AS10745, ARIN Operations |
| Company | ARIN Operations (business) | ARIN Operations (business) |
| BGP route | 199.43.0.0/24 |
2001:500:4::/48 |
| Anycast | No | No |

Same organization, same town, two different blocks: a /24 in IPv4 and a /48 in IPv6. A firewall rule or allowlist written for 199.43.0.0/24 never matches this server's IPv6 traffic, so every IP-based rule needs a counterpart in the other version.
IPv4 and IPv6 data in IPGeolocation.io
IPGeolocation.io treats IPv4 and IPv6 as equals: the IP Geolocation API answers for any address in either version at one endpoint, with the same response structure, so your code needs one parser for both.
One request returns the fullest picture of an address: geolocation, security data (a 0 to 100 threat score with VPN, proxy, residential proxy, and Tor flags, also available on its own from the IP Security API), ASN, company, abuse contact, and time zone data, plus parsing of the visitor's user agent string. Which modules a request returns depends on the plan, and the API pricing page shows what each includes. The bulk endpoint takes up to 50,000 addresses per request, IPv4 and IPv6 mixed, and the IP geolocation database stores every range with its start and end address in either format, in CSV and MMDB.
The free tools handle the conversions: the IPv4 to IPv6 converter for the mapped form, the IPv6 CIDR calculator for block ranges, and IP to integer for storage. The IP Geolocation API documentation has request examples for both versions.
Frequently Asked Questions
There are 2¹²⁸ IPv6 addresses, about 340 undecillion (3.4 × 10³⁸), compared with 4,294,967,296 IPv4 addresses. Networks plan IPv6 by block rather than by address: one standard local network, a /64, holds about 18.4 quintillion addresses.
IPGeolocation.io's What is my IP page shows your IPv4 address and an IPv6 line, which reads "Not Detected" when your connection has no IPv6. Open it to check which addresses your connection uses.
Your provider runs dual stack, giving your connection an address in each version so it can reach sites that support either one. Sites you visit may log either address, depending on which version each connection used.
Usually not; turn it off only to test whether one device or service fails over IPv6. Dual-stack devices already fall back to IPv4 when IPv6 fails, so a failing IPv6 path is worth reporting, not hiding.
Only as notation: an IPv4 address can be written as an IPv4-mapped IPv6 address, such as ::ffff:192.0.2.1, which software uses internally. That doesn't give a device IPv6 connectivity; a real IPv6 address comes from your network.
Neither is faster by design, but shared IPv4 can get in the way: RFC 6598 lists console games among the services that fail when two subscribers share one public IPv4 address through carrier-grade NAT. Where your provider, console, and game support IPv6, keeping it on can avoid that sharing.
Not for years. In October 2026, fewer than half of users worldwide could use IPv6 at all, so dropping IPv4 would leave most users unable to reach a service directly.







