[{"data":1,"prerenderedAt":609},["ShallowReactive",2],{"guide-ipv6-hexadecimal-addressing":3},{"id":4,"title":5,"body":6,"date":601,"description":602,"extension":603,"meta":604,"navigation":402,"path":605,"readingTime":450,"seo":606,"stem":607,"__hash__":608},"guides\u002Fguides\u002Fipv6-hexadecimal-addressing.md","IPv6 and Hexadecimal Addressing",{"type":7,"value":8,"toc":594},"minimark",[9,13,18,21,32,50,53,126,129,133,136,142,147,150,156,179,188,193,195,201,213,216,277,290,294,297,303,306,360,366,370,373,376,416,419,488,492,572,582,590],[10,11,12],"p",{},"IPv6 addresses are 128 bits long, written as eight groups of four hexadecimal digits. That gives us 340 undecillion possible addresses — enough to assign trillions of addresses to every square meter of Earth's surface. The hexadecimal notation is not arbitrary; it compresses the 128-bit binary address into a human-parseable format. Understanding the hex representation and its shorthand rules is essential for network configuration, firewall rules, and debugging connectivity issues.",[14,15,17],"h2",{"id":16},"structure-of-an-ipv6-address","Structure of an IPv6 Address",[10,19,20],{},"An IPv6 address is 128 bits divided into eight 16-bit groups, each written as four hexadecimal digits and separated by colons:",[22,23,28],"pre",{"className":24,"code":26,"language":27},[25],"language-text","2001:0db8:85a3:0000:0000:8a2e:0370:7334\n","text",[29,30,26],"code",{"__ignoreMap":31},"",[10,33,34,35,38,39,42,43,38,46,49],{},"Each group represents 16 bits (2 bytes), so four hex digits cover the range ",[29,36,37],{},"0000"," through ",[29,40,41],{},"ffff"," — which is ",[29,44,45],{},"0",[29,47,48],{},"65535"," in decimal.",[10,51,52],{},"Breaking this down:",[54,55,56,75],"table",{},[57,58,59],"thead",{},[60,61,62,66,69,72],"tr",{},[63,64,65],"th",{},"Component",[63,67,68],{},"Bits",[63,70,71],{},"Hex Digits",[63,73,74],{},"Example",[76,77,78,95,111],"tbody",{},[60,79,80,84,87,90],{},[81,82,83],"td",{},"Full address",[81,85,86],{},"128",[81,88,89],{},"32",[81,91,92],{},[29,93,94],{},"2001:0db8:85a3:0000:0000:8a2e:0370:7334",[60,96,97,100,103,106],{},[81,98,99],{},"One group",[81,101,102],{},"16",[81,104,105],{},"4",[81,107,108],{},[29,109,110],{},"0db8",[60,112,113,116,118,121],{},[81,114,115],{},"One hex digit",[81,117,105],{},[81,119,120],{},"1",[81,122,123],{},[29,124,125],{},"d",[10,127,128],{},"The address space is logically divided: the first 64 bits are the network prefix (assigned by your ISP or organization), and the last 64 bits are the interface identifier (usually derived from the MAC address via EUI-64 or randomly generated for privacy).",[14,130,132],{"id":131},"shorthand-rules","Shorthand Rules",[10,134,135],{},"Full IPv6 addresses are verbose. Two compression rules make them manageable:",[10,137,138],{},[139,140,141],"strong",{},"Rule 1 — Drop leading zeros within each group:",[22,143,145],{"className":144,"code":26,"language":27},[25],[29,146,26],{"__ignoreMap":31},[10,148,149],{},"becomes:",[22,151,154],{"className":152,"code":153,"language":27},[25],"2001:db8:85a3:0:0:8a2e:370:7334\n",[29,155,153],{"__ignoreMap":31},[10,157,158,159,161,162,165,166,168,169,171,172,168,175,178],{},"The ",[29,160,110],{}," shortens to ",[29,163,164],{},"db8",", ",[29,167,37],{}," becomes ",[29,170,45],{},", and ",[29,173,174],{},"0370",[29,176,177],{},"370",".",[10,180,181],{},[139,182,183,184,187],{},"Rule 2 — Replace one consecutive sequence of all-zero groups with ",[29,185,186],{},"::"," :",[22,189,191],{"className":190,"code":153,"language":27},[25],[29,192,153],{"__ignoreMap":31},[10,194,149],{},[22,196,199],{"className":197,"code":198,"language":27},[25],"2001:db8:85a3::8a2e:370:7334\n",[29,200,198],{"__ignoreMap":31},[10,202,158,203,205,206,208,209,212],{},[29,204,186],{}," replaces the two consecutive zero groups. You can only apply this rule once per address — otherwise, the parser cannot determine how many zero groups each ",[29,207,186],{}," represents. For example, ",[29,210,211],{},"2001::1234::5678"," is invalid because the position of the omitted zeros is ambiguous.",[10,214,215],{},"Some compressed examples:",[54,217,218,228],{},[57,219,220],{},[60,221,222,225],{},[63,223,224],{},"Full Form",[63,226,227],{},"Compressed",[76,229,230,242,254,266],{},[60,231,232,237],{},[81,233,234],{},[29,235,236],{},"fe80:0000:0000:0000:0000:0000:0000:0001",[81,238,239],{},[29,240,241],{},"fe80::1",[60,243,244,249],{},[81,245,246],{},[29,247,248],{},"0000:0000:0000:0000:0000:0000:0000:0001",[81,250,251],{},[29,252,253],{},"::1",[60,255,256,261],{},[81,257,258],{},[29,259,260],{},"2001:0db8:0000:0000:0000:0000:0000:0000",[81,262,263],{},[29,264,265],{},"2001:db8::",[60,267,268,273],{},[81,269,270],{},[29,271,272],{},"0000:0000:0000:0000:0000:0000:0000:0000",[81,274,275],{},[29,276,186],{},[10,278,279,280,282,283,286,287,289],{},"The loopback address ",[29,281,253],{}," is IPv6's equivalent of ",[29,284,285],{},"127.0.0.1",". The unspecified address ",[29,288,186],{}," is used in binding to indicate \"listen on all interfaces.\"",[14,291,293],{"id":292},"prefix-notation","Prefix Notation",[10,295,296],{},"IPv6 uses CIDR notation for subnetting, identical to IPv4:",[22,298,301],{"className":299,"code":300,"language":27},[25],"2001:db8::\u002F32\n",[29,302,300],{"__ignoreMap":31},[10,304,305],{},"This means the first 32 bits are the network prefix, and the remaining 96 bits are available for subnet and host addressing. Common prefix lengths:",[54,307,308,318],{},[57,309,310],{},[60,311,312,315],{},[63,313,314],{},"Prefix",[63,316,317],{},"Purpose",[76,319,320,330,340,350],{},[60,321,322,327],{},[81,323,324],{},[29,325,326],{},"\u002F128",[81,328,329],{},"Single host address",[60,331,332,337],{},[81,333,334],{},[29,335,336],{},"\u002F64",[81,338,339],{},"Standard subnet (typical LAN)",[60,341,342,347],{},[81,343,344],{},[29,345,346],{},"\u002F48",[81,348,349],{},"Organization allocation",[60,351,352,357],{},[81,353,354],{},[29,355,356],{},"\u002F32",[81,358,359],{},"ISP or large organization block",[10,361,362,363,365],{},"A ",[29,364,336],{}," is the smallest recommended subnet in IPv6. Unlike IPv4, where subnets are often \u002F24 or smaller, IPv6 assumes a \u002F64 as the baseline — even for a point-to-point link.",[14,367,369],{"id":368},"ipv6-and-hex-conversion","IPv6 and Hex Conversion",[10,371,372],{},"When configuring firewalls, writing route filters, or parsing packet captures, you often need to convert between hex groups and decimal or binary.",[10,374,375],{},"Each hex digit maps to 4 bits:",[22,377,381],{"className":378,"code":379,"language":380,"meta":31,"style":31},"language-python shiki shiki-themes github-light github-dark","# Convert an IPv6 group to decimal\nint('85a3', 16)  # 34211\n\n# Convert decimal back to hex group\nformat(34211, '04x')  # '85a3'\n","python",[29,382,383,391,397,404,410],{"__ignoreMap":31},[384,385,388],"span",{"class":386,"line":387},"line",1,[384,389,390],{},"# Convert an IPv6 group to decimal\n",[384,392,394],{"class":386,"line":393},2,[384,395,396],{},"int('85a3', 16)  # 34211\n",[384,398,400],{"class":386,"line":399},3,[384,401,403],{"emptyLinePlaceholder":402},true,"\n",[384,405,407],{"class":386,"line":406},4,[384,408,409],{},"# Convert decimal back to hex group\n",[384,411,413],{"class":386,"line":412},5,[384,414,415],{},"format(34211, '04x')  # '85a3'\n",[10,417,418],{},"For subnet calculations, you need to work with the full 128-bit value:",[22,420,422],{"className":378,"code":421,"language":380,"meta":31,"style":31},"import ipaddress\n\n# Parse and inspect\naddr = ipaddress.ip_address('2001:db8::1')\nnet = ipaddress.ip_network('2001:db8::\u002F32')\n\n# Check membership\naddr in net  # True\n\n# List first few hosts in a \u002F64 subnet\nsubnet = ipaddress.ip_network('2001:db8:1::\u002F64')\nlist(subnet.hosts())[:5]  # First 5 host addresses\n",[29,423,424,429,433,438,443,448,453,459,465,470,476,482],{"__ignoreMap":31},[384,425,426],{"class":386,"line":387},[384,427,428],{},"import ipaddress\n",[384,430,431],{"class":386,"line":393},[384,432,403],{"emptyLinePlaceholder":402},[384,434,435],{"class":386,"line":399},[384,436,437],{},"# Parse and inspect\n",[384,439,440],{"class":386,"line":406},[384,441,442],{},"addr = ipaddress.ip_address('2001:db8::1')\n",[384,444,445],{"class":386,"line":412},[384,446,447],{},"net = ipaddress.ip_network('2001:db8::\u002F32')\n",[384,449,451],{"class":386,"line":450},6,[384,452,403],{"emptyLinePlaceholder":402},[384,454,456],{"class":386,"line":455},7,[384,457,458],{},"# Check membership\n",[384,460,462],{"class":386,"line":461},8,[384,463,464],{},"addr in net  # True\n",[384,466,468],{"class":386,"line":467},9,[384,469,403],{"emptyLinePlaceholder":402},[384,471,473],{"class":386,"line":472},10,[384,474,475],{},"# List first few hosts in a \u002F64 subnet\n",[384,477,479],{"class":386,"line":478},11,[384,480,481],{},"subnet = ipaddress.ip_network('2001:db8:1::\u002F64')\n",[384,483,485],{"class":386,"line":484},12,[384,486,487],{},"list(subnet.hosts())[:5]  # First 5 host addresses\n",[14,489,491],{"id":490},"special-address-ranges","Special Address Ranges",[54,493,494,505],{},[57,495,496],{},[60,497,498,501,503],{},[63,499,500],{},"Range",[63,502,314],{},[63,504,317],{},[76,506,507,520,533,546,559],{},[60,508,509,514,517],{},[81,510,511],{},[29,512,513],{},"::1\u002F128",[81,515,516],{},"Loopback",[81,518,519],{},"Local testing",[60,521,522,527,530],{},[81,523,524],{},[29,525,526],{},"fe80::\u002F10",[81,528,529],{},"Link-local",[81,531,532],{},"Auto-configured, no routing",[60,534,535,540,543],{},[81,536,537],{},[29,538,539],{},"fc00::\u002F7",[81,541,542],{},"Unique local",[81,544,545],{},"Private networks (like 10.x.x.x)",[60,547,548,553,556],{},[81,549,550],{},[29,551,552],{},"2001:db8::\u002F32",[81,554,555],{},"Documentation",[81,557,558],{},"Reserved for examples (never routed)",[60,560,561,566,569],{},[81,562,563],{},[29,564,565],{},"ff00::\u002F8",[81,567,568],{},"Multicast",[81,570,571],{},"One-to-many communication",[10,573,574,575,577,578,581],{},"The documentation prefix ",[29,576,552],{}," is the IPv6 equivalent of the ",[29,579,580],{},"192.0.2.0\u002F24"," documentation range in IPv4. Use it in examples and tutorials — it will never be assigned to a real network.",[10,583,584,585,589],{},"Understanding IPv6 addressing requires comfort with hexadecimal notation. Practice hex conversions with the number base tool at ",[586,587,588],"a",{"href":588},"\u002Ftools\u002Fnumber-base",", which handles bidirectional conversion between hex, decimal, binary, and octal with detailed step breakdowns.",[591,592,593],"style",{},"html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}",{"title":31,"searchDepth":393,"depth":393,"links":595},[596,597,598,599,600],{"id":16,"depth":393,"text":17},{"id":131,"depth":393,"text":132},{"id":292,"depth":393,"text":293},{"id":368,"depth":393,"text":369},{"id":490,"depth":393,"text":491},"2026-05-28","How IPv6 uses hexadecimal notation and shorthand rules for 128-bit internet addresses.","md",{},"\u002Fguides\u002Fipv6-hexadecimal-addressing",{"title":5,"description":602},"guides\u002Fipv6-hexadecimal-addressing","ErlXpIGq85WxP_m9eppwAFALS2HqHr6wIXvKdBVglf0",1780401334647]