← Hashito System Home 日本語 Tools Blog
Input

About IPv6 text representation

Expanded and abbreviated form

An IPv6 address is 128 bits split into eight 16-bit groups, written in hexadecimal and separated by colons. Writing every group with four digits gives the fully expanded form. In practice the abbreviated form is used, dropping leading zeros and collapsing a run of all-zero groups into a double colon.

The RFC 5952 recommended representation

Because the same address can be written in several ways, RFC 5952 defines rules that narrow it down to one. Drop leading zeros; use the double colon once, on the longest run of all-zero groups; prefer the leftmost run when two runs tie; do not use a double colon for a single zero group; and write hexadecimal letters in lowercase. Normalizing to this form lets you compare log entries and configuration files as plain strings.

Zone IDs and IPv4-mapped addresses

Link-local addresses are often written with an interface name (zone ID) after a percent sign, as in fe80::1%en0. Addresses that embed an IPv4 address, such as ::ffff:192.0.2.128, are also common. This tool accepts both: the zone ID is preserved, and the IPv4 part is converted into hexadecimal groups.

Frequently asked questions

How are the IPv6 abbreviation rules defined?

RFC 5952 defines the recommended text representation. Leading zeros in each group are dropped, a run of two or more all-zero groups is replaced once by a double colon, the double colon is applied to the longest run and to the leftmost one when runs tie, and hexadecimal letters are written in lowercase. This tool compresses addresses exactly by those rules.

Why can a double colon appear only once in an address?

The double colon does not record how many groups it replaced. The count is recovered from the fact that an address always has eight groups. If it appeared twice, there would be no way to decide how many groups belong to each position, so the address could not be expanded again.

Is the address I enter sent to a server?

No. Expansion, compression and prefix calculation all run in JavaScript inside your browser. The address you enter is never sent to or stored on a server.