Segments, Packets, and Frames are structured data units formed at different layers of the OSI model to ensure organized and reliable network communication. As data moves from higher to lower layers, each unit is created through encapsulation and carries specific addressing information for transmission.
- Data is divided at Transport, Network, and Data Link layers
- Each layer adds its own header during encapsulation
- Segments operate at the Transport layer using port-based communication.
- Packets enable routing across multiple networks using IP addresses.
- Frames handle final delivery over physical networks using MAC addresses.

Segment
When data is transmitted from the application layer, it is divided into smaller units based on the Maximum Segment Size (MSS) to ensure efficient delivery. Each unit is then encapsulated with a TCP header, forming a segment, which is the Protocol Data Unit (PDU) at the Transport layer in the OSI Model. The Key Components of a TCP Header are:
- Source Port: Identifies the sending application or service.
- Destination Port: Specifies the target application or service on the receiving device.
- Sequence Number: Ensures that segments are reassembled in the correct order.
- Flag Bits: Control communication (e.g., start/end of transmission, acknowledgment, or segmentation control).
- Checksum: Verifies data integrity by detecting errors during transmission.
- Options: Provides additional configurations such as segment size and performance tuning.
Source and destination ports play a crucial role in delivering the segment to the correct application on the receiver’s system. The checksum is calculated using the TCP header, the data, and a pseudo-header from the IP layer to ensure accurate and reliable transmission. After encapsulation and error-checking, these structured data units are referred to as segments.
Packets
Once the Transport Layer generates segments, the Network Layer (usually using the Internet Protocol, IP) further processes them to create packets. These packets are essential for routing data across different networks and ensuring it reaches the correct destination device. An IP packet consists of a Header( typically 20 bytes, but can go up to 60 bytes ) and Body (contains the segment from the transport layer). The Fields in the IP Header are:
- Source IP Address: Specifies the origin of the packet.
- Destination IP Address: Specifies the final destination of the packet.
- TTL (Time To Live): Defines the packet’s lifespan. It decreases by 1 at each hop (router). When TTL reaches 0, the packet is discarded to prevent infinite looping.
- Identification: Helps in reassembling fragmented packets at the destination.
- Protocol: Indicates the transport layer protocol used in the payload (e.g., TCP or UDP).
- Version: Specifies the IP version being used (IPv4 or IPv6).
- Flags and Fragment Offset: Used to manage fragmentation and reassembly of packets.
Thus, the IP header and payload (which contains the Transport Layer segment) together form an IP packet. This layer handles routing and forwarding across networks, and if the packet exceeds the Maximum Transmission Unit (MTU), it is fragmented into smaller pieces for transmission and reassembled at the destination.
Frames
When data moves from the Network Layer to the Data Link Layer, each packet is encapsulated with a frame header and trailer, forming a frame, which is the Protocol Data Unit (PDU) of the Data Link Layer in the OSI Model. Frames are responsible for node-to-node delivery within the same network and ensure reliable transfer over a physical link. A frame consists of a header (control information), a payload (packet from the Network Layer), and a trailer (used for error detection such as CRC). The Key Components of a Frame are:
- Source MAC Address: Identifies the sender’s network interface.
- Destination MAC Address: Identifies the receiver’s network interface.
- Type/Length Field: Indicates the protocol type or size of the payload.
- Payload: Carries the IP packet from the Network Layer.
- Frame Check Sequence (FCS): Used for error detection using CRC.

Segments vs Packets vs Frames
| Feature | Segments | Packets | Frames |
|---|---|---|---|
| Layer | Transport Layer (Layer 4) | Network Layer (Layer 3) | Data Link Layer (Layer 2) |
| Contains | Only raw data | Data + Source and Destination IP Addresses | Data + IP Addresses + MAC (hardware) Addresses |
| Used In | Organizing data before sending | Routing data between different networks | Transferring data directly between connected devices |
| Size | Can vary in size | Usually smaller, broken down for easier routing | Fixed size based on the network type (e.g., Ethernet) |
| Header | Basic header with port numbers | More complex header with IP addresses | Most detailed header with MAC addresses |
| Main Job | Splitting data into manageable pieces | Routing data across networks | Handling actual physical transmission of data |
| Addressing | No addressing information | Uses IP addresses for routing | Uses MAC addresses for direct device communication |