Semrush Keyword Guide

TCP Header Size - Minimum Length, Options, and Data Offset

TCP headers are variable length. A basic TCP header is 20 bytes, but options can extend it up to 60 bytes. The Data Offset field tells where payload data begins.

Key Takeaways

Minimum TCP header size is 20 bytes.

Data Offset is measured in 32-bit words.

TCP options increase header length.

Payload starts after the header indicated by Data Offset.

Minimum TCP header size

The fixed portion of a TCP header is 20 bytes. It includes ports, sequence and acknowledgment numbers, data offset, flags, window size, checksum, and urgent pointer.

How Data Offset works

The Data Offset field tells how many 32-bit words are in the TCP header. Multiply the value by 4 to get bytes. A value of 5 means 20 bytes; a value of 15 means 60 bytes.

Why options matter

Options such as maximum segment size, window scale, timestamps, and selective acknowledgment can appear after the fixed header. If a parser ignores Data Offset, it may treat options as payload.

Practical Reference

ItemValueAnalysis Note
Minimum20 bytesNo TCP options.
Maximum60 bytesData Offset max value is 15 words.
Unit32-bit wordsMultiply by 4 for bytes.
Common mistakeAssuming fixed sizeOptions make TCP variable length.

FAQ

Why is the TCP header not always 20 bytes?

TCP options extend the header to carry features such as MSS, timestamps, and window scaling.

How do I find where TCP payload starts?

Read Data Offset, multiply it by 4, and skip that many bytes from the start of the TCP header.