Skip to main content

What fields make up a TCP header?

The TCP header is the control part of a TCP segment, containing all the information needed for reliable data transmission.

More simply: the TCP header is a set of fields TCP uses to manage the connection, order, and delivery of data.


Main fields of the TCP header

1. Source Port

  • 16 bits
  • indicates which application the data was sent from

2. Destination Port

  • 16 bits
  • indicates which application the data is intended for

3. Sequence Number

  • 32 bits
  • the number of the first data byte in this segment
  • used for:
    • correct order
    • detecting loss

4. Acknowledgment Number

  • 32 bits
  • indicates which next byte is expected
  • used to acknowledge data delivery

5. Data Offset

  • shows the size of the TCP header
  • needed to determine where the data begins

6. Reserved bits

  • not used
  • kept "for the future"

7. Control flags (Flags)

Small switch bits that control the connection:

  • SYN - establishing a connection
  • ACK - acknowledging receipt
  • FIN - correctly closing a connection
  • RST - forcibly resetting a connection
  • PSH - push data to the application immediately
  • URG - urgent data

8. Window Size

  • determines how much data the receiver is ready to accept
  • used for flow control

9. Checksum

  • checks the integrity of the TCP segment
  • if the checksum does not match, the segment is dropped

10. Urgent Pointer

  • used only if the URG flag is set
  • rarely used today

11. TCP Options

  • optional fields
  • used for:
    • MSS
    • Window Scaling
    • SACK, and others

Minimum and maximum size

  • Minimum TCP header size: 20 bytes
  • Maximum (with options): up to 60 bytes

What matters for the interview

  • the TCP header is larger than the UDP header
  • it is exactly these fields that make TCP:
    • reliable
    • order-managing
    • congestion-controlling
  • routers do not analyze the TCP header

In short, for the interview

The TCP header consists of the source and destination ports, the sequence and acknowledgment numbers, control flags, the window size, the checksum, and additional options that provide reliable end-to-end data transmission.

Short Answer

Interview ready
Premium

A concise answer to help you respond confidently on this topic during an interview.