Standard UDP Header Fields Explained

The User Datagram Protocol (UDP) is a lightweight, connectionless transport layer protocol designed for minimal overhead and fast data transmission. This article provides a clear breakdown of the standard UDP header structure, explaining its fixed 8-byte (64-bit) size and examining each of the four core fields responsible for routing and data integrity.

A standard UDP header consists of exactly four fields, each 16 bits (2 bytes) in length, resulting in a total fixed header size of 8 bytes:

1. Source Port (16 Bits)

The Source Port field identifies the application or process sending the datagram on the source host. This field allows the receiving device to know where to send a reply if necessary. * Size: 2 bytes (16 bits). * Values: Range from 0 to 65535. * Note: In IPv4, this field is optional; if the sender does not expect a reply, it can be set to zero.

2. Destination Port (16 Bits)

The Destination Port field specifies the receiving application or service port on the destination device. The operating system uses this port number to deliver the datagram payload to the correct process. * Size: 2 bytes (16 bits). * Values: Range from 0 to 65535 (e.g., Port 53 for DNS). * Note: This field is mandatory for standard routing.

3. Length (16 Bits)

The Length field indicates the total size of the UDP datagram in bytes, which includes both the 8-byte UDP header and the encapsulated data (payload). * Size: 2 bytes (16 bits). * Minimum Value: 8 bytes (representing a header with zero payload data). * Maximum Theoretical Value: 65535 bytes (limited in practice by the underlying IP packet limits).

4. Checksum (16 Bits)

The Checksum field is used for error detection across the UDP header, the encapsulated payload, and an IP “pseudo-header” (which includes the source IP, destination IP, and protocol number). * Size: 2 bytes (16 bits). * Usage: When the receiving host recalculates the checksum and detects a mismatch, the datagram is silently discarded. * Note: The checksum is optional in IPv4 (represented as all zeros if unused), but it is mandatory in IPv6.