Home › Developer Tools › IPv6 Expander & Compressor

IPv6 Expander & Compressor

Paste one IPv6 address or a whole list. Each one is validated, expanded to all eight 4-digit groups and compressed to the canonical RFC 5952 form, with zone IDs, prefix lengths and embedded IPv4 addresses kept intact.

Last updated:

InputStatusCompressed (RFC 5952)ExpandedType

Address details

Advertisement
Advertisement

How to use the IPv6 Expander & Compressor

  1. Paste IPv6 addresses, one per line. Brackets, ports, zone IDs and /prefix lengths are accepted.
  2. Press Compress All for the shortest canonical form or Expand All for the full 39-character form.
  3. Check the table for each address's validity, both forms, its type and reverse DNS name.
  4. Choose the IPv4 option to write IPv4-mapped and NAT64 addresses with a dotted IPv4 tail, as RFC 5952 recommends.
  5. Copy or download the converted list or the full table as CSV.

RFC 5952 compression rules

  1. Drop leading zeros in every group: 0db8 → db8, 0000 → 0.
  2. Use :: for the longest run of two or more consecutive zero groups.
  3. If two runs tie, shorten the first one.
  4. Never use :: for a single zero group.
  5. Write hex letters in lowercase.
Full formCanonical compressed formRule
2001:0db8:0000:0000:0000:ff00:0042:83292001:db8::ff00:42:8329leading zeros + longest run
2001:0db8:0000:0000:0001:0000:0000:00012001:db8::1:0:0:1tie: first run wins
2001:0000:0000:0001:0000:0000:0000:00012001:0:0:1::1longest run wins
2001:0db8:0000:0001:0001:0001:0001:00012001:db8:0:1:1:1:1:1single zero group stays
0000:0000:0000:0000:0000:0000:0000:0001::1loopback
0000:0000:0000:0000:0000:0000:0000:0000::unspecified address
2001:0DB8:0000:0000:0000:0000:0000:000A2001:db8::alowercase
0000:0000:0000:0000:0000:ffff:c000:0280::ffff:192.0.2.128IPv4-mapped, dotted tail (§5)

How expansion works

An IPv6 address is 128 bits written as eight 16-bit groups. To expand fe80::1:2: there are 3 written groups (fe80, 1, 2), so :: stands for 8 − 3 = 5 zero groups. Padding each group to four digits gives fe80:0000:0000:0000:0000:0000:0001:0002. The full form is always 39 characters (32 hex digits and 7 colons), which makes it handy for sorting, database keys and string comparison.

With an embedded IPv4 tail the last two groups come from the four IPv4 octets: 192.0.2.128 → (192 × 256 + 0) = 0xc000 and (2 × 256 + 128) = 0x0280.

Special IPv6 address ranges

PrefixType
::/128, ::1/128Unspecified, loopback
::ffff:0:0/96IPv4-mapped addresses
64:ff9b::/96NAT64 IPv4/IPv6 translation
2000::/3Global unicast (the public internet)
2001::/32, 2002::/16Teredo, 6to4 transition
2001:db8::/32Documentation and examples
fc00::/7Unique local addresses (private, like RFC 1918)
fe80::/10Link-local (needs a zone ID such as %eth0)
ff00::/8Multicast (ff02:: = link-local scope)

Writing IPv6 in URLs and with ports

Because colons separate the groups, an IPv6 address in a URL must be in square brackets: https://[2001:db8::a]:8443/. A zone ID in a URL is written as %25 (RFC 6874), for example http://[fe80::1%25eth0]/. The tool accepts both forms and strips the brackets and port before converting.

Frequently asked questions

How do you compress an IPv6 address?

RFC 5952 defines one canonical form: write hex digits in lowercase, drop leading zeros in every group, and replace the longest run of two or more all-zero groups with ::. If two runs are equally long, the first one is shortened. A single zero group stays as 0.

How do you expand an IPv6 address?

Replace :: with as many 0000 groups as needed to make eight groups in total, then pad every group to four hex digits. 2001:db8::1 becomes 2001:0db8:0000:0000:0000:0000:0000:0001.

Why is 2001:db8:0:1:1:1:1:1 not shortened?

The :: shorthand must not be used for a single 16-bit zero group (RFC 5952, section 4.2.2), so the canonical form keeps the 0. Some older tools still write 2001:db8::1:1:1:1:1, which is valid but not canonical.

What is a zone ID like %eth0?

Link-local addresses (fe80::/10) exist on every interface, so a zone ID after % tells the operating system which interface to use, for example fe80::1%eth0 or fe80::1%3 on Windows. The tool keeps the zone ID unchanged in both forms.

Can I use IPv4 notation inside IPv6?

Yes. The last 32 bits may be written as a dotted IPv4 address, as in ::ffff:192.0.2.128 (IPv4-mapped) or 64:ff9b::198.51.100.7 (NAT64). The expanded form always shows pure hex: 0000:0000:0000:0000:0000:ffff:c000:0280.

Which addresses are rejected?

Addresses with more than one ::, more or fewer than eight groups, groups longer than four hex digits, non-hex characters, an invalid embedded IPv4 part, an empty zone ID or a prefix length above 128. The table explains the exact problem.

Is my data sent anywhere?

No. Validation and conversion run entirely in your browser.

Are all the tools on FreeToolCabin tested for quality and accuracy?

Yes! Every tool on our site undergoes automated Q/A testing in real browser environments to ensure high precision, correct output, and zero errors. If you happen to spot a bug or have a suggestion, please contact us at [email protected] and our team will review it right away.

Related tools

URL ParserBreak a URL into its parts and edit query string parameters with a live rebuild.Binary TranslatorConvert text to binary, hex, octal and back.User Agent ParserSee your user agent and parse any UA string into browser, OS, engine and device.Website Down CheckerCheck if a website is down for everyone.IPv6 TestTest whether your connection supports IPv6, see your IPv4 and IPv6 addresses and check any site.Punycode ConverterConvert international domain names, emails and URLs between Unicode and xn-- Punycode, in bulk.JSON FormatterBeautify, minify and validate JSON, with a collapsible tree view.SQL Formatter & BeautifierFormat, beautify or minify SQL queries for MySQL, PostgreSQL and more.JavaScript BeautifierFormat and beautify messy or minified JavaScript, or minify it.HTML FormatterBeautify and indent HTML code with a live preview.CSS FormatterBeautify CSS with indent controls and optional property sorting.XML FormatterBeautify, validate and minify XML with a collapsible tree view.ZIP File CreatorCompress files and folders into a ZIP.YAML Validator & FormatterValidate, format and minify YAML, and convert YAML to JSON or back.HTML MinifierMinify HTML: strip comments and whitespace safely and see how many bytes you save.CSS MinifierMinify CSS with csso or a built-in engine and see the size saved instantly.JavaScript MinifierMinify JavaScript with Terser: compress, mangle and see how many bytes you save.JSON MinifierMinify and validate JSON, sort keys and see exactly how many bytes you save.Code Diff CheckerCompare two code files side by side or unified, with syntax colors and changes highlighted.GraphQL FormatterPretty-print and indent GraphQL queries, mutations and schemas, or minify them, instantly.CSS ValidatorValidate CSS: syntax errors, unknown properties and invalid values by line, plus auto-fix.Gzip Compress / DecompressGzip or deflate text and files, get Base64 output, and decompress Base64 or .gz files.IBAN ValidatorCheck an IBAN's mod-97 checksum, country and length, and see its bank code and account parts.JavaScript Syntax CheckerCheck JavaScript for syntax errors with line and column, for any ES version, script or module.JSON Schema ValidatorValidate JSON against a JSON Schema (draft-07, 2019-09, 2020-12) with clickable error paths.Markdown FormatterBeautify Markdown with Prettier: list markers, prose wrap, aligned tables and live preview.PHP FormatterBeautify PHP code with Prettier PHP: PSR-12 style, indent and brace options, syntax errors.TypeScript FormatterFormat TypeScript and TSX code with Prettier: width, tabs, semicolons and quotes options.XML MinifierMinify and validate XML: strip whitespace and comments, keep CDATA, see the size savings.C# FormatterBeautify C# code online: Allman or K&R braces, indent size and line width, clang-format option.HTML ValidatorCheck HTML for errors and warnings with line numbers, locally or with the W3C Nu checker.Java FormatterBeautify Java code online: indent size, brace style and line width, with clang-format option.JavaScript ObfuscatorObfuscate JavaScript with string encoding, renaming and control-flow flattening presets.Phone Number FormatterFormat and validate lists of phone numbers to E.164, international or national style.Python FormatterFormat Python code in Black/Ruff style: line length, quote style, indent, copy or download.Responsive Design CheckerPreview any website at phone, tablet, laptop and desktop sizes side by side, with rotate and zoom.Browser Compatibility CheckerSearch CSS, JavaScript and HTML features and see which browser versions support them.Core Web Vitals CheckerCheck real-user LCP, INP and CLS for any URL or site and see if it passes Core Web Vitals.Luhn Algorithm CheckerValidate numbers with the Luhn mod 10 check or calculate the missing check digit, step by step.XSD ValidatorValidate XML against an XSD schema in your browser and see each error with its line number.Strftime Format BuilderBuild Python and C strftime format strings by clicking tokens, with a live preview and reference.Heading Structure CheckerPaste HTML to see its H1-H6 outline and catch missing H1s, multiple H1s and skipped levels.Website Hosting CheckerFind out who hosts a website: hosting provider, IP addresses, ASN, network owner and location.Routing Number ValidatorCheck a US ABA routing number's checksum and format and see its Federal Reserve district.Spam Word CheckerScan an email subject and body for spam trigger words, excess caps, exclamation marks and risky links.Check Digit CalculatorCalculate or validate check digits for UPC, EAN, GTIN, SSCC, ISBN, ISSN and mod 11 codes.
See all 41 Code Formatters & Validators →