IPv4 Header Decoder

Paste the hex bytes of an IPv4 header and read every field it carries: the length, the DS byte, the flags and fragment offset, the protocol, both addresses and whether the header checksum still adds up.

Twenty bytes or more. Spaces, colons, 0x prefixes and dump offset labels are ignored, so a capture line, a tcpdump -x line or a hex dump pastes straight in. Bytes past the header length are treated as payload.

The decoded header fields
Version
Header length
Total length
DS field
Identification
Flags
Fragment offset
TTL
Protocol
Header checksum
Source
Destination
Options

The header is read at the fixed offsets RFC 791 gives it: the first nibble is the version and the second is the header length in 32-bit words, then the DS byte (six DSCP bits and two ECN bits), the total length, the identification, the flag bits and the 13-bit fragment offset in eight-byte units, the TTL, the protocol number, the checksum, and the two 32-bit addresses. The checksum is checked the way RFC 1071 describes: the 16-bit one's-complement sum of the whole header, checksum field included, must come to 0xFFFF, and the value recorded is the complement of the sum of the header with that field zeroed. Protocol names come from the IANA Protocol Numbers registry. Options are reported but not decoded, the payload is not read, and IPv6 and transport headers are out of scope. A total length that disagrees with the number of bytes pasted is reported, not refused, because a header is often pasted on its own. Everything is calculated in your browser; nothing is pasted anywhere else.