Protocols & models · Offline reference

UDP Header Reference

Interpret each field in the eight-byte UDP header and check a datagram length. UDP length begins at the UDP source-port field. Subtract eight to obtain 1,192 data bytes in an ordinary datagram. Account for the IP header separately.

Inputs

Result

Selection
All entries
Calculated or matching entries
Field or caseSize or exampleInterpretation
Source port16 bitsIdentifies the sender's transport endpoint when used. The original UDP specification permits zero when a source port is unnecessary.
Destination port16 bitsNames the receiving transport endpoint in the context of a destination IP address.
Length16 bits in bytesIncludes both UDP header and data. For ordinary UDP, a value below eight cannot describe a complete header.
Checksum16 bitsCovers a pseudo-header and the UDP datagram. A zero field can indicate omission in IPv4. Ordinary IPv6 UDP requires a checksum.
Header-only datagram8 bytesLength eight means zero data bytes. Datagram boundaries still exist.
48-byte application message56-byte UDP datagramAdd 8 bytes once. Adding a 20-byte IPv4 header without options gives a 76-byte IP packet.
In this guide11 sections

Introduction

Interpret each field in the eight-byte UDP header and check a datagram length. UDP length begins at the UDP source-port field. Subtract eight to obtain 1,192 data bytes in an ordinary datagram. Account for the IP header separately.

Method and concepts

UDP adds source and destination ports, a length and a checksum to a message. It requires no transport handshake. Each delivered datagram retains its boundary. An application with a receive buffer too small for a message can encounter truncation according to its socket interface.

  1. Select an entry to isolate the relevant case.
  2. Read the associated evidence and compare it with your local configuration.

UDP diagram

  1. Telemetry sample · 120 B
  2. UDP datagram · 128 B
  3. IPv6 packet · 168 B
  4. Receiver reads one sample
A base IPv6 header adds 40 bytes outside the eight-byte UDP header. This example has no IPv6 extension headers.

Worked examples

Read the Source port entry

  1. 16 bits
  2. Identifies the sender's transport endpoint when used. The original UDP specification permits zero when a source port is unnecessary.

UDP: Size a sample and interpret its arrival

  1. Encode 120 bytes of sample data, including an application sequence counter. The UDP length is 8 + 120 = 128 bytes.
  2. Add 40 IPv6 bytes. The IP packet is 168 bytes, well within a 1280-byte path budget under these assumptions.
  3. At the collector, samples 41 and 43 arrive before 42. Their application counters reveal the reordering. UDP assigns no delivery deadline or recovery policy.

Reference table

UDP Header Reference reference
Field or caseSize or exampleInterpretation
Source port16 bitsIdentifies the sender's transport endpoint when used. The original UDP specification permits zero when a source port is unnecessary.
Destination port16 bitsNames the receiving transport endpoint in the context of a destination IP address.
Length16 bits in bytesIncludes both UDP header and data. For ordinary UDP, a value below eight cannot describe a complete header.
Checksum16 bitsCovers a pseudo-header and the UDP datagram. A zero field can indicate omission in IPv4. Ordinary IPv6 UDP requires a checksum.
Header-only datagram8 bytesLength eight means zero data bytes. Datagram boundaries still exist.
48-byte application message56-byte UDP datagramAdd 8 bytes once. Adding a 20-byte IPv4 header without options gives a 76-byte IP packet.

Reading the result

An application’s configured maximum message size should account for every header within the path MTU. Losing one IP fragment prevents successful reassembly of the complete datagram. A smaller supported message size can avoid fragmentation.

Common mistakes

  • Subtracting just eight bytes from an IP MTU while forgetting the IP header.
  • Treating the absence of a transport handshake as evidence that the remote application is ready.

Frequently asked questions

Does a 1,200-byte UDP length include the IP header?

UDP length begins at the UDP source-port field. Subtract eight to obtain 1,192 data bytes in an ordinary datagram. Account for the IP header separately.

Can UDP carry a zero-byte message?

Yes. An ordinary UDP datagram with no application data has a length of eight bytes.

Is UDP always faster than TCP?

The workloads have different requirements. If the application needs retries and ordering, those mechanisms still consume time and capacity wherever they are implemented.

Does UDP guarantee delivery or ordering?

No. UDP sends datagrams without TCP's connection setup, retransmission, or ordered byte-stream guarantees. An application can add its own reliability if needed.

Why might an application use UDP?

It may need datagram boundaries, low setup overhead, multicast behavior, or custom loss handling. The application must decide whether and how to recover missing data.

Does a UDP checksum always exist in IPv4 and IPv6?

IPv6 requires a UDP checksum except for narrowly specified tunnel cases; IPv4 permits a zero checksum for UDP. Receivers and application requirements still matter.

Can UDP use a familiar service port?

Yes. Port numbers are interpreted together with transport protocol. TCP port 53 and UDP port 53 are distinct endpoints even though both are associated with DNS use.

Does UDP preserve one send as one receive?

UDP preserves datagram boundaries when a datagram is delivered, but delivery is not guaranteed. The application must handle missing, duplicated, late, or reordered datagrams as needed.

Is QUIC carried over UDP?

Yes. QUIC uses UDP datagrams as its substrate while implementing transport features and TLS-based security above UDP. That does not make plain UDP itself reliable or encrypted.

Should every UDP application ignore congestion?

No. Applications sending sustained traffic still need appropriate congestion behavior and rate control. UDP's minimal transport service does not remove that responsibility.

Can a UDP datagram be fragmented?

An IP packet carrying UDP can encounter fragmentation or path-MTU constraints. Applications that send large datagrams should consider the path size and loss cost of fragmentation.

What does the UDP length field include?

It counts the UDP header and UDP payload. The UDP header is eight bytes, and the enclosing IP packet has its own length accounting.

Why can a large UDP datagram be risky?

It can exceed the path MTU and be fragmented or dropped. Losing one IP fragment can make the whole UDP datagram unusable, so applications often keep datagrams small.

Why might DNS switch from UDP to TCP?

A resolver can retry over TCP when a UDP response is truncated or when TCP is otherwise required. Firewall rules that permit only UDP can therefore break some DNS operations.

Does UDP checksum detect every possible corruption?

It detects many transmission errors but is not cryptographic authentication and can have a finite undetected error probability. Secure applications need appropriate cryptographic integrity protection.

Does QUIC make UDP delivery reliable?

QUIC implements its own transport reliability, congestion behavior, and encryption above UDP. Those features belong to QUIC, not to the UDP service itself.

Further learning and references