Online IPv6 Converter - IP Shortening & Expanding Tool

🔷

IPv6 Address Converter

4-in-1 multi-directional converter — IPv6 • Binary • Decimal • Hex — results update as you type

⚡ Try:

📊 Converted Values

⌨️

Waiting for valid input…

Select a mode, start typing — results appear instantly.

About This IPv6 Address Converter

This IPv6 Address Converter is a free, browser-based 4-in-1 bidirectional tool that converts any valid IPv6 address between four numeric representations — IPv6 notation, Binary, Decimal, and Hexadecimal — in real time as you type.

Unlike most online converters that rely on floating-point arithmetic, this tool uses JavaScript's native BigInt engine to handle the full 128-bit address space with arbitrary precision, meaning no rounding errors occur even when converting the maximum IPv6 value of 340,282,366,920,938,463,463,374,607,431,768,211,455.

Every conversion is accompanied by visible, step-by-step calculation breakdowns that mirror the methods taught in university networking courses and Cisco Networking Academy (NetAcad), making it an ideal companion for students studying for the Cisco CCNA or CompTIA Network+ certifications.

The tool also auto-detects 15 distinct IPv6 address types (including Global Unicast, Teredo, ORCHIDv2, 6to4, and IPv4-Mapped), supports optional /0–/128 CIDR prefix notation in From IPv6 mode, and keeps the browser URL hash in sync with the active mode so pages remain shareable and bookmarkable without triggering a page reload.

IPv6 Address Structure

An IPv6 address is a 128-bit numeric identifier assigned to a network interface.

To keep the notation human-readable, those 128 bits are divided into eight groups of 16 bits, called hextets (also referred to as groups, fields, or quartets in different textbooks).

Each hextet is expressed as four hexadecimal digits separated by colons, giving the full expanded form a total of 32 hex characters and 7 colons.

Because each hexadecimal digit represents exactly 4 bits (one nibble), a single hextet such as 2001 encodes 16 bits of address information.

The hexadecimal alphabet uses the digits 0–9 and the letters a–f (case-insensitive, though RFC 5952 mandates lowercase in canonical compressed form), giving 16 possible values per character — hence the name base 16.

The total address space is 2128, or approximately 3.4 × 1038 unique addresses, which is roughly 340 undecillion — enough to assign billions of addresses to every atom on Earth's surface.

Field Value
Total bits 128
Number of hextets 8
Bits per hextet 16
Hex digits per hextet 4
Total hex digits 32
Address space 2128 ≈ 3.4 × 1038

Expanded vs Compressed IPv6

RFC 5952 (A Recommendation for IPv6 Address Text Representation) defines two canonical forms of an IPv6 address. The expanded form writes every hextet as exactly four hex digits with no omissions, for example 2001:0db8:0000:0000:0000:0000:0000:0001. The compressed form applies two successive simplification rules to produce the shortest unambiguous representation.

Rule 1 — Omit leading zeros within each hextet. Each hextet is treated independently. Any leading zeros at the left side of a hextet may be dropped so that 0db8 becomes db8, 0000 becomes 0, and 0001 becomes 1. A hextet that is all zeros must retain at least one digit, written as 0.

Rule 2 — Replace the longest consecutive sequence of all-zero hextets with a double colon (::). After leading zeros are removed, any consecutive run of one or more hextets that each contain only 0 may be replaced by the double-colon shorthand.

The double colon may appear only once in any address; a second occurrence would create ambiguity because a parser could not determine how many zero groups each :: represents.

If two or more runs of all-zero hextets have the same maximum length, the tie-breaker rule mandates that the leftmost (first) run is replaced. Applying both rules, the expanded address 2001:0db8:0000:0000:0000:0000:0000:0001 compresses to 2001:db8::1.

Stage Result
Expanded 2001:0db8:0000:0000:0000:0000:0000:0001
After Rule 1 (drop leading zeros) 2001:db8:0:0:0:0:0:1
After Rule 2 (replace zero run with ::) 2001:db8::1

How to Convert IPv6 to Binary

The academic method for converting an IPv6 address to binary uses the concept of the nibble boundary.

A nibble is exactly 4 bits, and because one hexadecimal digit maps perfectly onto one nibble, every hex character can be independently converted to a 4-bit binary pattern without carrying or borrowing between digits.

This is taught in the Cisco NetAcad curriculum as the 8-4-2-1 rule: the four bit positions within a nibble have place values of 8, 4, 2, and 1 respectively (the standard binary positional weights for bits 3 down to 0).

To convert any hex digit, write a 1 in each bit position whose weight is needed to sum to the decimal value of the digit, and 0 everywhere else.

For example, the hex digit A has decimal value 10.

Using 8-4-2-1: 8 is needed (8 ≤ 10, remainder 2), 4 is not needed (4 > 2), 2 is needed (2 ≤ 2, remainder 0), 1 is not needed — giving the nibble 1010. Similarly, F (decimal 15) = 8+4+2+1 = 1111, and 3 (decimal 3) = 2+1 = 0011.

Applying this rule to every hex digit in sequence, the full IPv6 address 2001:0db8::1 (expanded: 2001:0db8:0000:0000:0000:0000:0000:0001) produces 128 bits arranged as eight 16-bit groups separated by colons in binary notation.

Hex Digit Decimal 8 4 2 1 Binary Nibble
0 0 0 0 0 0 0000
1 1 0 0 0 1 0001
5 5 0 1 0 1 0101
A 10 1 0 1 0 1010
D 13 1 1 0 1 1101
F 15 1 1 1 1 1111

How to Convert Binary to IPv6

Converting from binary back to IPv6 is the exact reverse of the nibble method and follows four precise academic steps.

Step 1 — Pad to 128 bits. If the binary string contains colons separating the 16-bit groups, remove them and confirm the result is exactly 128 characters containing only 0 and 1; if shorter, left-pad with zeros.

Step 2 — Group into 16-bit hextets. Split the 128-bit string into eight equal blocks of 16 bits each, reading left to right. Each block represents one hextet of the IPv6 address.

Step 3 — Split each hextet into four 4-bit nibbles. Divide each 16-bit block into four consecutive nibbles of 4 bits each.

Step 4 — Convert each nibble to one hex digit using the 8-4-2-1 rule in reverse. Multiply each bit by its positional weight (8, 4, 2, or 1), sum the products, and look up or compute the corresponding hex digit (0–9, a–f). For example, the nibble 1011 gives 8×1 + 4×0 + 2×1 + 1×1 = 8+0+2+1 = 11 = b.

After converting all 32 nibbles, insert colons between each group of four hex digits to obtain the fully expanded IPv6 address, then optionally apply RFC 5952 compression rules.

How to Convert IPv6 to Decimal

To express an IPv6 address as a single decimal (base-10) integer, the entire 32-character hexadecimal string — after stripping colons and expanding any compression — is treated as one contiguous base-16 number. The academic positional-value formula is:

Decimal = d31 × 1631 + d30 × 1630 + … + d1 × 161 + d0 × 160

where dn is the decimal value of the n-th hex digit counting from the right (least significant).

Because 1631 alone is approximately 4.95 × 1037, the maximum IPv6 decimal value — all hex digits equal to f — is 340,282,366,920,938,463,463,374,607,431,768,211,455.

This number far exceeds the safe integer range of IEEE 754 double-precision floating point (which loses precision above 253 − 1, or about 9 × 1015), which is why standard JavaScript Number arithmetic and most pocket calculators produce incorrect results for IPv6 decimal conversions.

This tool exclusively uses JavaScript's BigInt primitive, which supports integers of arbitrary size with exact integer arithmetic, guaranteeing that every decimal result is perfectly accurate regardless of magnitude.

How to Convert Decimal to IPv6

The academic method for converting a large decimal integer back to IPv6 uses successive division by 16 (extracting hex digits least-significant-first via repeated modulo operations) or, equivalently, a direct BigInt-to-hexadecimal conversion.

The algorithmic approach proceeds as follows: given the decimal value N, compute N mod 16 to get the least-significant hex digit, then set N = floor(N / 16) and repeat until N equals zero. Reading the remainders in reverse order gives the hex string.

In practice, modern programming languages expose a built-in base conversion: BigInt(N).toString(16) in JavaScript produces the hexadecimal string directly.

That string is then left-padded with zeros to a total of exactly 32 hex characters, after which it is split into eight groups of four characters and joined with colons to produce the expanded IPv6 form. RFC 5952 compression is applied last to yield the canonical compressed address.

This tool performs all these steps internally and displays each intermediate stage in the Calculation Steps panel so learners can follow the complete derivation.

IPv6 and Hexadecimal Format

Hexadecimal (base 16) was chosen for IPv6 notation primarily for compactness: one hex digit encodes four bits, so the full 128-bit address requires only 32 hex digits compared to 128 binary digits or a 39-digit decimal number.

This nibble-aligned encoding also has a practical engineering advantage — because nibble boundaries align perfectly with 4-bit hardware registers and network masks that commonly fall on nibble boundaries (e.g., /4, /8, /12, /48, /64), bitwise prefix matching is computationally efficient.

The 32 hex-digit representation of IPv6 maps to 128 bits without any waste: 32 digits × 4 bits/digit = exactly 128 bits.

When displayed with the 0x prefix (as produced by this tool's Hexadecimal output, e.g., 0x20010db8000000000000000000000001), the value can be directly consumed by programming languages and network device configuration scripts.

Colons used in IPv6 notation are purely cosmetic delimiters; they carry no arithmetic significance and are stripped before any conversion calculation is performed.

What Does IPv6 Prefix Length Mean?

An IPv6 prefix length, written in CIDR (Classless Inter-Domain Routing) notation as a forward slash followed by an integer between 0 and 128 (for example 2001:db8::/32 or fe80::1/64), defines the exact boundary that divides the 128-bit address into two functional parts.

The leftmost n bits (where n is the prefix length) form the Network Prefix, which identifies the subnet or routing domain.

The remaining 128 − n bits form the Interface Identifier (or host portion), which identifies a specific interface within that subnet.

A /64 prefix — the most common assignment for end-user subnets per IETF recommendations — means the first 64 bits are the network prefix and the last 64 bits are the interface ID, often auto-configured using EUI-64 or generated randomly via RFC 4941 privacy extensions.

A /48 prefix is typically assigned to an entire site, a /32 to an ISP customer allocation, and a /128 identifies a single host.

This tool accepts the optional prefix notation in From IPv6 mode, validates that the prefix value is an integer between 0 and 128, displays a green hint confirming the detected prefix, and then uses only the address portion for all format conversions — the prefix is preserved for reference but does not alter any binary, decimal, or hex output.

Common IPv6 Address Types

The IPv6 address space is divided into well-defined regions by the leading bits of the first hextet. The tool automatically identifies 15 address types; the five most frequently encountered in networking courses and real-world deployments are described below.

  • Global Unicast (2000::/3): The equivalent of IPv4 public addresses. Any address whose first three bits are 001 (binary), meaning the first hextet falls between 2000 and 3fff, is a globally routable unicast address. ISPs assign these addresses to customers and they are reachable across the public Internet. The documentation range 2001:db8::/32 is carved out of this space for use in examples, RFCs, and teaching materials — it must never appear in live routing tables.
  • Link-Local Unicast (fe80::/10): Automatically configured on every IPv6-capable interface during stateless address autoconfiguration (SLAAC). The address is valid only on the directly attached link and is never forwarded by a router. Link-local addresses always begin with the 10-bit prefix 1111111010 in binary, corresponding to the range fe80:: through febf::. They are used for neighbour discovery (NDP), router solicitation, and router advertisement messages.
  • Multicast (ff00::/8): Used to send a single packet to multiple destinations simultaneously without broadcasting to the entire network. An IPv6 address whose first 8 bits are all 1 (first hextet begins with ff) is a multicast address. Unlike IPv4, IPv6 has no broadcast; all broadcast-equivalent functions (e.g., all-nodes ff02::1, all-routers ff02::2, solicited-node addresses) are implemented as multicast.
  • Loopback (::1/128): The single address ::1 (127 leading zero bits followed by a single 1 bit) is the loopback address, functionally equivalent to 127.0.0.1 in IPv4. Packets sent to ::1 are processed entirely within the host's network stack and never leave the device. It is commonly used to test the TCP/IP stack and local network services.
  • Unspecified (::/128): The all-zeros address :: (all 128 bits equal to zero) represents the absence of an address. It is used in the source field of packets sent by a host before it has been assigned an IPv6 address — for example, during DHCPv6 solicitation or duplicate address detection (DAD). It must never be assigned to an interface as a permanent address or used as a routing destination.

Step-by-Step Examples

Example: Convert 2001:db8::1 from Compressed → Expanded → Binary

Stage 1 — Identify the compressed address. The input 2001:db8::1 contains a double colon (::) which represents one or more consecutive all-zero hextets. Count the explicit hextets: 2001 and db8 on the left of ::, and 1 on the right — that is 3 explicit hextets. Since a full IPv6 address has 8 hextets, the :: expands to 8 − 3 = 5 all-zero hextets.

Stage 2 — Write the expanded form. Replace :: with five 0000 hextets and zero-pad each explicit hextet to four digits: 2001 stays as 2001, db8 becomes 0db8, and 1 becomes 0001. The expanded form is:

2001:0db8:0000:0000:0000:0000:0000:0001

Stage 3 — Convert each hextet to 16-bit binary using the nibble method. Each of the four hex digits in a hextet is independently converted to a 4-bit nibble using the 8-4-2-1 rule, then the four nibbles are concatenated to form the 16-bit binary group.

Hextet # Hex Nibble Breakdown 16-bit Binary
1 2001 2=0010, 0=0000, 0=0000, 1=0001 0010000000000001
2 0db8 0=0000, d=1101, b=1011, 8=1000 0000110110111000
3–7 0000 0=0000, 0=0000, 0=0000, 0=0000 0000000000000000
8 0001 0=0000, 0=0000, 0=0000, 1=0001 0000000000000001

Final binary result (8 groups of 16 bits separated by colons):

0010000000000001:0000110110111000:0000000000000000:0000000000000000:0000000000000000:0000000000000000:0000000000000000:0000000000000001

Practice Questions

The following exercises are representative of questions found in Cisco CCNA examinations and university networking coursework. Attempt each one manually before revealing the answer.

Question 1 — Compress an IPv6 Address

Write the compressed (RFC 5952 canonical) form of the following expanded IPv6 address: fe80:0000:0000:0000:0202:b3ff:fe1e:8329

Answer: First apply Rule 1 (remove leading zeros per hextet): fe80:0:0:0:202:b3ff:fe1e:8329. Then apply Rule 2 (replace the longest consecutive run of 0 hextets with ::): hextets 2, 3, and 4 are all 0 — a run of three — giving the compressed form fe80::202:b3ff:fe1e:8329.

Question 2 — Expand a Compressed IPv6 Address

Write the fully expanded form of 2001:db8:0:1::ab3.

Answer: Count explicit hextets: 2001, db8, 0, 1 on the left of :: (4 hextets) and ab3 on the right (1 hextet), totalling 5. The :: therefore represents 8 − 5 = 3 all-zero hextets. Inserting them and zero-padding all hextets to 4 digits: 2001:0db8:0000:0001:0000:0000:0000:0ab3.

Question 3 — Hex-to-Binary Nibble Conversion

Using the 8-4-2-1 rule, convert the hextet a3f0 to its 16-bit binary representation.

Answer: Convert each nibble independently. a (10) = 8+2 = 1010. 3 (3) = 2+1 = 0011. f (15) = 8+4+2+1 = 1111. 0 (0) = 0000. Concatenated: 1010001111110000. You can verify: 0xa3f0 = 10 × 163 + 3 × 162 + 15 × 16 + 0 = 41,968 decimal, and the binary 1010001111110000 = 32768+8192+1024+512+256+128+64+16+8 = 41,968. ✓

Frequently Asked Questions

Why can't you use the double colon (::) more than once in an IPv6 address?

The double colon (::) is a shorthand that instructs parsers to insert as many consecutive all-zero 16-bit hextets as are needed to make the total hextet count equal to eight.

If two :: were present in a single address, a parser would face an unsolvable ambiguity: there would be no way to determine how many zero groups each :: represents, since the two expansions could be divided in multiple ways and all would produce a syntactically valid 128-bit value.

For example, if an address contained both :: twice, each double colon could independently expand to anywhere from one to several hextets, yet there is no delimiter to indicate the correct split. RFC 5952 and its predecessors therefore mandate that :: may appear at most once in any IPv6 address. Validators and parsers treat any address containing two or more :: occurrences as malformed and reject it.

What is an IPv4-Mapped IPv6 address?

An IPv4-Mapped IPv6 address is a special notation defined in RFC 4291 that embeds a 32-bit IPv4 address within the 128-bit IPv6 address space.

Its format is ::ffff:0:0/96, meaning the first 80 bits are all zeros, the next 16 bits are all ones (ffff), and the remaining 32 bits hold the IPv4 address.

For example, the IPv4 address 192.0.2.1 maps to the IPv6 address ::ffff:c000:0201 (or in mixed notation, ::ffff:192.0.2.1).

These addresses are used internally by dual-stack operating systems to allow IPv6-only sockets to communicate with IPv4 endpoints transparently — the kernel maps the incoming IPv4 connection to an IPv6 socket using this prefix. They are never routed across the public Internet and should not appear in routing tables. This tool detects any address matching the ::ffff:0:0/96 range and labels it as IPv4-Mapped IPv6.

What is the difference between a Link-Local and a Unique Local IPv6 address?

Both Link-Local and Unique Local addresses are non-globally-routable, but they serve different scopes. Link-Local addresses (fe80::/10) are valid only on a single network link — the directly connected segment.

They are automatically derived from the interface's MAC address or generated randomly and are used for protocols that operate at the link layer, such as Neighbour Discovery Protocol (NDP) and Router Advertisement. A router will never forward a packet with a link-local source or destination address to another interface.

Unique Local Addresses (fc00::/7, in practice fd00::/8), defined in RFC 4193, are the IPv6 analogue of IPv4 private address ranges (10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16).

They are intended for use within a site or across a set of cooperating sites and may be routed within an organisation's internal network, but they should not be advertised to or accepted from the public Internet.

They use a 40-bit pseudo-random Global ID to minimise the chance of collision when two organisations' private networks are merged.

Why does converting a large IPv6 decimal number give a wrong result in a normal calculator?

Standard calculators and most programming languages that use IEEE 754 double-precision floating-point arithmetic can represent integers exactly only up to 253 − 1, which is 9,007,199,254,740,991 (approximately 9 × 1015).

The maximum IPv6 decimal value is 340,282,366,920,938,463,463,374,607,431,768,211,455 — a 39-digit number that is approximately 3.4 × 1038.

Any floating-point calculation involving numbers larger than 253 − 1 will silently round to the nearest representable floating-point value, introducing errors that can be millions or billions of units away from the true result. This is not a rounding display issue; the stored value itself is incorrect.

The correct solution is to use arbitrary-precision integer arithmetic, such as Python's built-in int type, Java's BigInteger class, or JavaScript's native BigInt primitive (available in all modern browsers since 2020).

This tool uses JavaScript BigInt exclusively for all decimal conversions, ensuring that every result — including the maximum value and all values in between — is computed and displayed with exact integer precision.

Subscribe
Notify of
guest

0 Corrections & Clarifications