IPv6 Subnet Calculator
Work out the network, host range and address count for any IPv6 prefix.
Results are provided as is, for general information. Check anything important before relying on it. See the Terms of Use.
About this tool
Computes IPv6 subnets with full 128-bit arithmetic — no 32-bit shortcuts, so counts stay exact at any prefix. Enter an address or address/prefix (2001:db8::/32) and get the fully expanded form (8 groups of 4 hex digits), the canonical RFC 5952 compressed form, the network address, first and last host, the total address count, the interface-ID size and the number of /64 subnets inside when the prefix is below 64. Parsing is full RFC 4291: ::-compression, mixed IPv4 tails like ::ffff:192.168.1.1, zone IDs (%eth0) stripped and reported, plus classification — global unicast, link-local, ULA, multicast, loopback and v4-mapped.
How it works
Addresses in subnet = 2^(128 − prefix) /64 subnets inside a shorter prefix = 2^(64 − prefix) Network = address with the last (128 − prefix) bits set to 0
An IPv6 address has 128 bits; the prefix says how many belong to the network and the rest identify hosts. Sites are normally given a /48 or /56 and split into /64 subnets, since a /64 is the standard size for a single LAN.
| Question | Working | Answer |
|---|---|---|
| How many /64 subnets are in 2001:db8::/32? | 2^(64 − 32) | 4,294,967,296 /64 subnets |
| What is the network for 2001:db8:abcd:12::1/64? | clear the last 64 bits | 2001:db8:abcd:12::/64 |
When to use it
Questions
Why does the calculator need big integers?
An IPv6 address is 128 bits; JavaScript's Number represents integers exactly only up to 2^53. A /16 holds 2^112 addresses — any ordinary-number arithmetic would silently round it. Everything here runs on BigInt, so counts like 5192296858534827628530496329220096 are exact, not approximations.
What is ::ffff:192.168.1.1?
The IPv4-mapped representation: an IPv4 address carried inside IPv6 notation, used by dual-stack software. The parser accepts it, shows its expanded 16-byte form and classifies it as v4-mapped. The same notation appears in logs as ::ffff:203.0.113.7 — that is an IPv4 address, not an IPv6 one.
Why did the compressed form drop zeros in a way I did not expect?
RFC 5952 defines the canonical text: leading zeros inside each group are removed, :: replaces only the single longest run of all-zero groups, and the leftmost run wins a tie. 2001:0db8:0000:0000:0000:0000:0000:0001 therefore compresses to 2001:db8::1, and :: is never used twice.
What is the %eth0 at the end of some addresses?
A zone ID — it scopes link-local addresses (fe80::/10) to one interface, since every interface has a fe80:: address and the bare address alone would be ambiguous. It is part of the local notation, not the address itself; the calculator strips it, reports it, and computes on the 128 bits.