Segmentation Explained with TCP and UDP Header
Segmentation is a process of dividing a large data stream into smaller pieces. It allows a host to send or receive a file of any size over any network. For example, if network bandwidth is 1 Mbps and the file size is 100 Mb, the host can divide the file into 100 or more pieces. After that, it sends them to the destination host separately. Since each piece consumes no more than the available network bandwidth, it can easily reach the destination. Upon receiving all pieces, the destination host reassembles them to reproduce the original file.
TCP supports segmentation while UDP does not. It means that if an application wants to use TCP to send its data, it can give TCP the data in its actual size. Depending on conditions such as data size and available network bandwidth, TCP performs segmentation on its own before packing data for transmission.
If an application wants to use UDP to send its data, it can’t give the data to UDP in its actual size. It has to use its own mechanism to determine whether segmentation is required. And if segmentation is required, it has to do it on its own before giving data to UDP.
Packing data for transmission
Both protocols similarly pack data. Both add a header with each data piece. A header mainly contains the following information:-
- The information required to send the segment to the correct destination.
- The information that is required to support the protocol-specific features.
Both TCP and UDP add the first type of information in the same manner. Both use two fields for this information: source port and destination port. Information about the application sending the data and the application receiving the data is added to the source port and destination port fields, respectively.
Protocols add the second type of information based on the services they offer. TCP provides several protocol-specific services, such as segmentation, windowing, and flow control. To provide these services, it adds the necessary information in the header.
The following figure shows a data piece with the TCP header.

| TCP header | Field description |
| Source port | Identify the application that is sending data from the source host. |
| Destination port | Identify the application that will receive the data at the destination host. |
| Sequence number | Identify lost segments and maintain sequencing during transmission. |
| Acknowledgment number | Send a verification of receipt of the segments and request the next segments. |
| Header length | A number that indicates where the data begins in the segment. |
| Reserved | Reserve for future use. Always set to zero. |
| Code bits | Define the control functions, including session setup and termination. |
| Window size | Set the number of segments to send before waiting for confirmation from the destination. |
| Checksum | CRC (cyclic redundancy check) of the header and data piece. |
| Urgent | Point to any urgent data in the segment. |
| Options | Define any additional options, such as the maximum segment size. |
| Data | A data piece that is produced from the segmentation. |
On the other hand, UDP neither provides any protocol-specific service nor adds any additional header information. The following figure shows data with a UDP header.

| Field | Description |
| Source port | Port number of the application that is transmitting data from the source computer. |
| Destination port | Port number of the application that will receive the data at the destination. |
| Length | Denote the length of the UDP header and the UDP data. |
| Checksum | CRC of the complete segment. The data that it received from the application. |
| Segment | Once a header is attached to the data (generated by TCP segmentation or received from the application via UDP), the resulting unit is called a segment. |
The following figure shows how segmentation works in both protocols.

Key points
- TCP uses segmentation while UDP does not.
- Both protocols use different header types to pack the data for transmission.
- The UDP header contains only information about the compulsory functions and is 8 bytes in length.
- The TCP header contains information for both compulsory and optional functions. The TCP header is 20 bytes long without options and 24 bytes with options.
This tutorial is part of the tutorial series "Networking reference models explained in detail with examples". Other parts of this series are the following.
Chapter 1 What is a Networking Model Explained
Chapter 2 OSI Model Advantages and Basic Purpose Explained
Chapter 3 Difference between original and modern TCP/IP models
Chapter 4 Similarities and Differences between the OSI and TCP/IP models
Chapter 5 Adjacent-layer and same-layer interactions
Chapter 6 Data Encapsulation and De-encapsulation Explained
Chapter 7 OSI Seven Layers Model Explained with Examples
Chapter 8 TCP/IP Reference Model Explained
Chapter 9 Application layer in the OSI and TCP IP layers models
Chapter 10 Presentation layer and Session layer of the OSI model
Chapter 11 The Transport Layer Explained
Chapter 12 Segmentation Explained with TCP and UDP Headers
Chapter 13 Connection Multiplexing Explained with Examples
Chapter 14 TCP Features and Functions Explained with Examples
Chapter 15 The Network Layer Explained
Chapter 16 The Data Link and Physical layers Explained
Conclsion
Segmentation is a vital process for efficient data transmission over networks. TCP handles segmentation and offers advanced features through its header, making it suitable for reliable, ordered communication. UDP, in contrast, provides a simpler, connectionless service with minimal header information, favoring speed over reliability. Understanding how these protocols manage data can help in choosing the right protocol for different networking scenarios.
Author Laxmi Goswami Updated on 2026-02-25