What Is a UDP Datagram? How UDP Packets Work

A User Datagram Protocol (UDP) datagram is a lightweight, connectionless data packet used to transmit information across IP networks at the Transport Layer. This article explains the core definition of a UDP datagram, details its compact 8-byte header structure, highlights its key operational characteristics, and explores the real-world applications where its speed and low latency are prioritized over guaranteed delivery.

Understanding the UDP Datagram

In computer networking, a datagram is an independent, self-contained entity of data carrying sufficient information to be routed from the source to the destination computer without reliance on earlier exchanges. When using UDP (User Datagram Protocol), data is packaged into these units and transmitted across an Internet Protocol (IP) network.

Unlike TCP (Transmission Control Protocol), UDP is connectionless. A UDP datagram is sent without establishing a prior connection via a handshake, and it does not require an acknowledgment from the receiving end to confirm receipt.

Structure of a UDP Datagram

A UDP datagram consists of two primary components: the Header and the Data (Payload).

The UDP header is fixed at just 8 bytes (64 bits) in size, split into four distinct 2-byte (16-bit) fields:

  1. Source Port (16 bits): Identifies the sending application’s port number. This field is optional; if not used, it is set to zero.
  2. Destination Port (16 bits): Identifies the receiving application’s port number on the destination device. This field is mandatory so the receiving system knows which process should handle the data.
  3. Length (16 bits): Specifies the total length of the UDP datagram in bytes, including both the 8-byte header and the payload. The minimum value is 8 (a header with no data).
  4. Checksum (16 bits): Provides error-checking for the header and payload to detect corrupted data during transit. In IPv4, this field is optional, but in IPv6, it is mandatory.

Following the header is the Data Payload, which contains the actual application data being transmitted.

Key Characteristics of UDP Datagrams

Common Use Cases

Because UDP datagrams minimize latency at the expense of guaranteed reliability, they are widely used in time-sensitive applications: