Can a UDP Packet Have a Zero-Byte Payload?

A User Datagram Protocol (UDP) packet can indeed have a payload of zero bytes. According to the official protocol specifications, a UDP datagram consists of an 8-byte header followed by the optional data payload. When no data is transmitted, the packet consists entirely of the IP and UDP headers. This article breaks down the technical structure of a zero-byte UDP packet, protocol length specifications, and the practical use cases for sending datagrams without payload data.

The UDP Header and Minimum Length

UDP is defined by RFC 768, which outlines the structure of a datagram. The UDP header is fixed at 8 bytes (64 bits) and contains four 2-byte fields:

  1. Source Port (16 bits)
  2. Destination Port (16 bits)
  3. Length (16 bits)
  4. Checksum (16 bits)

The Length field specifies the total length in bytes of the UDP datagram, which includes both the 8-byte header and the payload. Because the minimum possible length of the header itself is 8 bytes, the minimum theoretical and valid value for the UDP Length field is 8. A value of 8 indicates that there are zero bytes of data following the header.

Total Packet Size on the Wire

Even though the UDP payload is zero bytes, the packet transmitted over the physical network is not zero bytes in total. The network stack must still include the underlying layer headers:

Consequently, a zero-byte UDP datagram results in an IP packet of at least 28 bytes on an IPv4 network, or 48 bytes on an IPv6 network, before data link layer framing (such as Ethernet) is applied.

Common Use Cases for Zero-Byte UDP Packets

Sending a packet without a payload is useful in several networking scenarios where the presence or arrival of the packet itself conveys the necessary information:

Socket API Behavior

At the programming level, standard socket APIs fully support zero-length UDP transmissions.