Minimum and Maximum Length of the Header in the TCP Segment and the IP Datagram
Last Updated :
02 May, 2024
The minimum and maximum length of the header in the TCP segment is 20 Bytes and 60 bytes respectively. The minimum and maximum length of the header in the IP datagram are 20 Bytes and 60 Bytes respectively.
What is a TCP Header?
The below diagram represents the TCP header.
Necessary fields for TCP header
|
4B
|
Source Port
|
Destination Port
|
4B
|
Sequence Number
|
4B
|
Acknowledgment Number
|
4B
|
Header Length
|
Reserved
|
URG
|
ACK
|
PSH
|
RST
|
SYN
|
FIN
|
Window Size
|
4B
|
Checksum
|
Urgent Pointer
|
Optional Field for TCP header
|
0 Bytes to 40 Bytes
|
Options
|
Explanation for the Minimum and Maximum Length of Header in TCP Segment
In the header of the TCP segment, we may include or exclude the optional field as it is not necessary to include the optional field in every TCP segment. Other fields in the TCP header are always included in the TCP segment. To find the minimum length of the header in the TCP segment we take the Options field size as zero bytes and to find the maximum length of header in TCP segment we take Option field maximum size i.e., 40 Bytes. The size of the header is the sum of the size of other fields and size of option field.
Length of Header
|
Other Fields in TCP header
|
Option field in TCP header
|
Size of the Header in TCP Segment
|
Minimum
|
20 Bytes
|
0 Bytes
|
20B + 0B = 20 B
|
Maximum
|
20 Bytes
|
40 Bytes
|
20B + 40B = 60 B
|
Therefore,
Minimum Length of Header in TCP Segment = 20 Bytes or 160 bits
Maximum Length of Header in TCP Segment = 40 Bytes 0r 360 bits
What is IP Header?
The below diagram represents the IP header.
Necessary fields for IP header
|
4B
|
Version
|
Header Length
|
Type of Service
|
Total Length
|
4B
|
Identification
|
Reserve Bit
|
DF
|
MF
|
Fragment offset
|
4B
|
TTL
|
Protocol
|
Header Checksum
|
4B
|
Source IP
|
4B
|
Destination IP
|
Optional field for IP header
|
0B – 40B
|
Options
|
Explanation for the Minimum and Maximum Length of Header in IP Datagram
In the header of the IP segment, we may include or exclude the optional field as it is not necessary to include the optional field in every IP datagram. Other fields in the IP header are always included in the IP datagram. To find the minimum length of the header in IP datagram we take Option field size as zero bytes and to find the maximum length of header in IP datagram we take Option field maximum size i.e., 40 Bytes. The size of the header is the sum of the size of other fields and size of option field.
Length of Header
|
Other Fields in IP header
|
Option field in IP header
|
Size of the Header in IP Datagram
|
Minimum
|
20 Bytes
|
0 Bytes
|
20B + 0B = 20 B
|
Maximum
|
20 Bytes
|
40 Bytes
|
20B + 40B = 60 B
|
Therefore,
Minimum Length of Header in IP Datagram= 20 Bytes or 160 bits
Maximum Length of Header in IP Datagram= 40 Bytes 0r 360 bits
Conclusion
From the above discussion we can conclude that the maximum and minimum length of header in the TCP segment and IP datagram is 20 Bytes and 40 Bytes respectively. Both the headers have option field which may and may not be included in the header. If we do not include the option field, then we get the minimum length of header and when we include maximum option field then we get the maximum header length.
Minimum and Maximum Length of the header in the TCP Segment and the IP datagram – FAQs
What is TCP Segment?
The TCP Segment consists of two parts: TCP header and Data. It is the transfer unit of TCP.
What is the Minimum Header Length in TCP Segment?
The minimum header length in TCP segment is 20 Bytes or 160 bits.
What is IP Datagram?
The IP datagram consists of two parts: IP header and Data. It is transfer unit of IP.
What is the Maximum Header Length in IP Datagram?
The maximum length in IP datagram is 60 Bytes or 480 bits.
Share your thoughts in the comments
Please Login to comment...