6LoWPAN IPHC Header Compression Animation

See how LOWPAN_IPHC turns large IPv6/UDP headers into a few bytes on IEEE 802.15.4 links

animation
6lowpan
iphc
ipv6
udp
compression
802.15.4
networking
Interactive 6LoWPAN IPHC workbench showing IPv6 and UDP header compression, LOWPAN_IPHC bits, UDP NHC port modes, checksum constraints, frame budget effects, and mobile-safe reference material.

6LoWPAN IPHC Header Compression Animation

Animation 6LoWPAN Header Compression

6LoWPAN IPHC Compression

Explore how LOWPAN_IPHC removes predictable IPv6 fields and how UDP NHC compresses ports and checksum fields. Watch the byte budget change before deciding whether the packet fits a constrained IEEE 802.15.4 frame.

-- Compressed header
-- Bytes saved
-- Main caveat

48 bytes is the baseline

IPv6 is 40 bytes and UDP is 8 bytes before compression. On 802.15.4, that can consume most of the payload room.

IPHC sends decisions

The two-byte LOWPAN_IPHC base tells the receiver which IPv6 fields are inline and which are inferred.

UDP NHC is separate

When NH is compressed, a following UDP NHC byte describes port and checksum compression.

Checksum elision is restricted

RFC 6282 allows UDP checksum elision only with upper-layer authorization and an additional integrity check.

1

Frame Budget

Start from 48 bytes of IPv6 and UDP headers.

2

IPHC Base

Encode TF, NH, HLIM, CID, and address modes.

3

Addresses

Elide or carry source and destination address bytes.

4

UDP NHC

Compress UDP ports and decide checksum handling.

5

Result

Compare saved bytes and remaining frame room.

Frame Budget IPv6 plus UDP starts at 48 bytes before compression.

Frame Budget

IPv6 plus UDP starts at 48 bytes before compression.

Stage 1 of 5
6LoWPAN IPHC header compression animation A byte budget diagram showing uncompressed IPv6 and UDP headers, compressed LOWPAN_IPHC and UDP NHC fields, and the remaining IEEE 802.15.4 payload room. Safe CoAP packet Link-local IPv6 addresses, compressed next header, full CoAP ports, UDP checksum carried inline.
What to watch Start with frame pressure

A 48-byte IPv6/UDP header leaves little room for application data on small radio frames.

Diagnosis Most IPv6 fields are predictable

Version, payload length, link-local prefixes, and common hop limits usually do not need to be sent literally.

Result 9 bytes

The packet fits comfortably while preserving the UDP checksum.

How the Byte Count Is Calculated

The workbench uses a teaching model based on RFC 6282 field sizes. It shows header bytes, not full MAC or security overhead.

IPv6 baseline uncompressed = 40 byte IPv6 + 8 byte UDP The comparison starts from the normal IPv6 plus UDP header size of 48 bytes.
IPHC bytes iphc = 2 byte base + CID + inline IPv6 fields The base LOWPAN_IPHC dispatch and encoding are two bytes; CID adds one only when needed.
UDP NHC bytes udp_nhc = 1 byte NHC + port_bytes + checksum_bytes Both 0xf0b0-0xf0bf ports still need one shared byte for their 4-bit suffixes.
Frame pressure room_left = 81 byte example_budget - compressed_header The 81-byte budget approximates a constrained secured 802.15.4 payload case.

Controls

Pick a scenario, play through the compression stages, then adjust individual fields to see which bytes return.

Scenario
IPv6 IPHC fields
UDP NHC fields

Reference Material

Use these cards to connect the animation to practical 6LoWPAN implementation decisions.

IPHC Quick Reference
LOWPAN_IPHC baseThe base encoding is two octets: dispatch bits plus TF, NH, HLIM, CID, SAC, SAM, M, DAC, and DAM.
TF bitsTraffic Class and Flow Label can consume 4, 3, 1, or 0 bytes depending on ECN, DSCP, and flow label use.
NH bitNH=0 carries the next header inline. NH=1 means the next header is compressed using LOWPAN_NHC.
HLIM valuesHop limits 1, 64, and 255 are encoded directly. Other hop limits need one inline byte.
Address elisionLink-local or context-derived addresses can often omit the prefix and sometimes the full IID.
CID extensionA context identifier byte appears only when non-default context identifiers must be named.
UDP NHC Rules
UDP NHC IDThe UDP compression byte starts with the LOWPAN_NHC UDP identifier and then carries C and P fields.
Port suffixesPorts 0xf0b0 through 0xf0bf can carry only their 4-bit suffixes, one byte total for both ports.
CoAP portsCoAP 5683 and 5684 are not in the 0xf0b0 range, so they are commonly carried as full 16-bit ports.
Checksum inlineKeeping the UDP checksum costs two bytes and preserves normal end-to-end transport checking.
Checksum elisionElision is not a casual optimization; it requires authorization and an additional integrity check.
UDP lengthThe UDP Length field is always elided and inferred from lower layers by the decompressor.
Technical Accuracy Notes
127-byte radio frameIEEE 802.15.4 frames are small. MAC headers, security, and FCS reduce the payload available to 6LoWPAN.
Example budgetThis animation uses 81 bytes as a constrained teaching budget, not a universal MTU value.
Route-over caveatIn route-over forwarding, hop limit may change at each IP hop and often cannot stay compressed.
Context managementStateful compression only works if compressor and decompressor share the same context information.
Fragmentation still mattersHeader compression helps, but large IPv6 datagrams may still need 6LoWPAN fragmentation.
Validate on real stacksInteroperability depends on exact field encoding, context setup, security, and border router behavior.