UDP Maximum Packet Size - Length Field, MTU, and Fragmentation
UDP length is a 16-bit field, so the theoretical datagram size is large. In practice, MTU, IPv4 or IPv6 overhead, fragmentation, and application reliability concerns often require much smaller payloads.
Key Takeaways
UDP Length includes the 8-byte UDP header.
The theoretical limit comes from a 16-bit length field.
Practical payload size is usually limited by path MTU.
Large UDP datagrams increase fragmentation and loss risk.
Theoretical UDP size
The UDP Length field is 16 bits and includes both header and payload. Since the UDP header itself is 8 bytes, payload calculations must subtract that header before considering the IP layer.
Practical limits
Most real networks have an MTU that is much smaller than the theoretical UDP maximum. If a datagram exceeds the path MTU, IP fragmentation or packet loss can occur, depending on protocol version and path behavior.
How to debug size problems
Compare UDP Length, IP Total Length or IPv6 Payload Length, and the actual captured byte count. Mismatches indicate truncation, malformed packets, or an incorrect parser assumption.
Practical Reference
| Item | Value | Analysis Note |
|---|---|---|
| UDP header | 8 bytes | Subtract from UDP Length for payload size. |
| Length field | 16 bits | Counts header plus payload. |
| Practical constraint | Path MTU | Often more important than the theoretical maximum. |
| Risk | Fragmentation | Large datagrams are more fragile. |
FAQ
Why not always send maximum-size UDP datagrams?
Large datagrams are more likely to fragment or be dropped. Applications often choose smaller messages to improve reliability.
Does UDP split data automatically like TCP?
No. UDP preserves message boundaries. Applications decide how to divide data into datagrams.