Frame vs Packet vs Datagram

Run a Speed Test

Networking words can feel slippery because the same chunk of user data gets wrapped again and again. At one layer it is a segment, at another it is a packet, and on the wire it may be a frame. The words are not random. They tell you which layer you are looking at.

The Short Version

TermLayerCommon ExampleWhat It Contains
FrameLink layerEthernet frame, Wi-Fi frameMAC addresses, link-layer control, payload, error check
PacketNetwork layerIPv4 packet, IPv6 packetSource IP, destination IP, routing fields, payload
SegmentTransport layerTCP segmentPorts, sequence numbers, flags, payload
DatagramOften connectionless transport or network layerUDP datagram, IP datagramSelf-contained unit sent without a connection guarantee

How Encapsulation Works

Imagine your browser sends a small HTTPS request. The application creates data. TCP wraps it in a TCP segment. IP wraps that segment in an IP packet. Ethernet wraps the IP packet in an Ethernet frame. Each layer adds just enough information for its job.

At the receiver, the process reverses. The network card reads the frame, the operating system extracts the IP packet, the transport layer extracts the TCP segment, and the browser eventually receives the application data.

Frame: Local Delivery

A frame is used on a local link such as Ethernet or Wi-Fi. It contains source and destination MAC addresses because the link layer only needs to deliver data across the current local network segment. When a packet moves from one router to the next, it is put into a new frame for that next hop.

Packet: Routed Delivery

A packet is usually the IP-level unit that routers forward. It contains source and destination IP addresses, TTL or hop limit, protocol fields, and other routing information. Routers care about packets, not browser tabs or filenames.

Segment: Reliable Transport

TCP data is commonly called a segment. TCP segments carry port numbers, sequence numbers, acknowledgment numbers, and flags such as SYN, ACK, and FIN. Those fields let TCP build a reliable ordered stream on top of unreliable packet delivery.

Datagram: Self-Contained Delivery

Datagram is often used when each unit is independent rather than part of a guaranteed stream. UDP sends datagrams. IP has also historically used the phrase IP datagram. The key idea is that each datagram is sent on its own, without the connection state and retransmission behavior that TCP provides.

Why the Distinction Matters

  • If an Ethernet frame is too large, the local link may drop it.
  • If an IP packet is too large for the path, fragmentation or packet loss can occur.
  • If a TCP segment is lost, TCP can retransmit it.
  • If a UDP datagram is lost, the application must tolerate it or recover itself.
  • If you troubleshoot the wrong layer, you can chase the wrong problem.

A Simple Mental Model

The frame changes at every hop. The IP packet usually stays recognizable from source to destination, though some fields change. The TCP or UDP payload is what the sending and receiving applications care about. That is why packet captures often show nested views: frame, then IP packet, then TCP segment or UDP datagram, then application data.

Frequently Asked Questions

What is the difference between a frame and a packet?

A frame is the data unit at the link layer, such as Ethernet. A packet is usually the data unit at the network layer, such as IP.

Is a UDP datagram the same as an IP packet?

No. A UDP datagram sits inside an IP packet. The IP packet then sits inside a link-layer frame while crossing a local network.

What is encapsulation?

Encapsulation is the process of wrapping higher-layer data inside lower-layer headers and trailers so it can move across each part of the network.

Related Guides

More From This Section