Every packet on the internet opens with one of these two headers. IPv4's 20-byte header has carried the internet since 1981; IPv6's fixed 40-byte header, finalized in 2017, trades IPv4's variable-length options for a chain of separate extension headers and swaps a 32-bit address space for a 128-bit one. Toggle between them below - hover a field to light its bytes, click a field marked + for its lookup table. Color marks kind (see the key). Full protocol writeup and citations: deep-dive.md.
The IP header is layer 3 - it hands off to a transport header above and rides inside a link-layer frame below. Hover a row for the layer's own byte layout and a code snippet.
| IPv4 | IPv6 | |
|---|---|---|
| Header size | 20-60 bytes, variable (options) | 40 bytes, fixed - extensions are separate chained headers |
| Address length | 32 bits | 128 bits |
| Header checksum | yes - recomputed every hop | none - integrity pushed to upper layers |
| Fragmentation | routers may fragment in flight | source only, via a Fragment extension header |
| "next protocol" field | Protocol (byte 9) | Next Header (byte 6) - same IANA registry, same numbers |
| Broadcast | yes | none - multicast only |
| Address autoconfig | DHCP (or static) | SLAAC or DHCPv6 |
| Defining spec | RFC 791 (1981) | RFC 8200 (2017) |
First word (version, traffic class, flow label) is bit-packed, so it's drawn bit by bit. Everything after it is byte-aligned - payload length, next header, hop limit, then the two 128-bit addresses drawn byte by byte.
Version+IHL+DSCP+ECN pack into the first 2 bytes, so they're drawn bit by bit; Total Length and Identification are byte-aligned; Flags+Fragment Offset pack into 2 more bits; TTL, Protocol, Checksum, and both addresses are byte-aligned.
2001:db8::/32 for IPv6 (RFC 3849) and 192.0.2.0/24 / 203.0.113.0/24 for IPv4 (RFC 5737) - so nothing here is a real routable host.