TCP Header Decoder

Paste the hex bytes of a TCP segment and read the whole header: both ports, the sequence and acknowledgment numbers, the data offset, every control flag, the window, the urgent pointer and each option, with the checksum verified over the IPv4 or IPv6 pseudo-header.

Twenty bytes or more: the header plus any data. 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. The whole segment must be pasted for the checksum to verify, because the sum covers the data too.

IPv4, or IPv6 without brackets
used only for the pseudo-header
the shift from the handshake, if known
Control flags
—
Paste a segment above.
    Header fields, read at the offsets of RFC 9293 Figure 1
    Source port
    Destination port
    Sequence number
    Acknowledgment number
    Header length
    Reserved bits
    Flags
    Window
    Checksum
    Urgent pointer
    Options
    Data
    Sequence length
    Pseudo-header

    Decoded options

    The header is read at the fixed offsets RFC 9293 gives it: ports in the first four bytes, the 32-bit sequence and acknowledgment numbers, then a byte holding the data offset in 32-bit words above four reserved bits, a byte of control flags, the window, the checksum, the urgent pointer and the options up to the data offset. Options are walked one at a time: kinds 0 and 1 are a single byte, everything else carries a length that counts its own two bytes, and a length that leaves the header or cannot hold the kind is refused rather than guessed. The checksum is the one's complement of the one's complement sum of a pseudo-header and the whole segment, with the checksum field zeroed: IPv4 prefixes the addresses, a zero, protocol 6 and the segment length, IPv6 prefixes both addresses, a 32-bit length, three zero bytes and 6. A SYN window is never scaled, so the scale you enter is applied to every other segment. Port names are not looked up here — the Port Reference tool does that — and the data is shown as hex, not interpreted. Everything runs in your browser; nothing is pasted anywhere else.