Computer Networks · TCP
TCP Header Length: Minimum 20 Bytes and Maximum 60 Bytes
Overview
The TCP header is variable in length because it consists of five mandatory rows of 32 bits each plus an optional Options field. Its length ranges from a minimum of 20 bytes to a maximum of 60 bytes, a fact worth memorising for exams.
Key concepts
- Row size: Each row of the TCP header diagram is 32 bits wide, i.e. 4 bytes.
- Mandatory rows: The header has 5 fixed rows that are definitely required in every TCP header and cannot be omitted.
- Options field: The only optional part of the header; its maximum size is 40 bytes.
- Variable header length: Because of the Options field, the TCP header length is not fixed — it lies between 20 and 60 bytes.
- Units: All other fields are measured in bits, but the Options field is discussed in bytes.
How it works
- Each row of the TCP header is 32 bits = 4 bytes.
- Count the mandatory rows: Row 1 = 4 bytes, Row 2 = 4 bytes, Row 3 = 4 bytes, Row 4 = 4 bytes, Row 5 = 4 bytes.
- The fixed part is therefore bytes — the minimum header length.
- The only optional part is the Options field, which can take at most 40 bytes.
- Maximum header length = fixed part + maximum options = bytes.
Formulas
- Row size = 32 bits = 4 bytes
- Minimum TCP header length = 5 rows × 4 bytes = 20 bytes
- Maximum TCP header length = 20 bytes (fixed fields) + 40 bytes (maximum Options) = 60 bytes
- TCP header length = 20 bytes + size of Options field, where bytes
Revision summary
- Minimum TCP header size = 20 bytes (5 mandatory rows of 4 bytes each).
- Maximum Options size = 40 bytes.
- Maximum TCP header size = 60 bytes (20 + 40).
- The 5 fixed rows can never be omitted; only the Options field is optional.
- All other fields are measured in bits, but the Options field is measured in bytes.
- Keep the header-length fact handy — it is important for exams.
Previous-year exam insights
- The 4-bit Data Offset (header length) field counts 32-bit words: its minimum valid value is 5 (5 × 4 = 20 bytes) and maximum is 15 (15 × 4 = 60 bytes), so the same 20–60 byte bound follows from the field value itself, not only from the option size.
- Options are variable-length TLV (type/kind, length, value) fields and must be padded with zero bytes so that the header ends on a 32-bit boundary; the padding counts inside the 40-byte option space, so the header is always a multiple of 4 bytes.
- Common TCP options a student should be able to name: Maximum Segment Size (MSS), Window Scale factor, SACK-permitted and SACK blocks, and Timestamps — each consumes part of the 40-byte maximum option space.
- TCP checksum covers a pseudo-header (source IP, destination IP, protocol = 6, TCP segment length) plus the TCP header and data;
it is a 16-bit one's-complement sum, and since the pseudo-header contains IP addresses, the checksum is also an end-to-end (not per-link) check. - Because the mandatory header is 20 bytes, the protocol overhead per segment is at least 20 bytes (160 bits) plus the IP header;
segment/transport efficiency = payload / (payload + header) and decreases as header size grows toward 60 bytes with options. - In the fixed part of the TCP header, the 16-bit window field advertises the receive window size in bytes (maximum 65535 without the window-scale option), and the flag bits are URG, ACK, PSH, RST, SYN, FIN (plus ECE/CWR with congestion notification).