UDP, the User Datagram Protocol, is a transport protocol that sends individual messages called datagrams over IP without first establishing a connection. It is defined in RFC 768 and identified by IP protocol number 17. UDP adds only an eight-byte header to each message, providing port numbers for addressing and a checksum for integrity. The specification states plainly that delivery and duplicate protection are not guaranteed.
This minimal design makes UDP a connectionless protocol: there is no handshake, no UDP connection-establishment handshake and no built-in retransmission. Applications that need those properties either build them on top of UDP or use TCP instead. A voice call, a name lookup and a reliable file transfer can therefore use the same transport while making very different choices about lost messages.
How UDP Datagrams Travel
A UDP datagram consists of a header followed by application data. The header has four fields of 16 bits each: a source port, a destination port, the total length in octets including the header, and a checksum. The source port is optional and set to zero when unused, in which case the receiver has no port to reply to. The checksum covers the header, the data and a pseudo-header taken from the IP layer, helping detect accidental corruption and some misdelivery. It is not cryptographic proof of the sender's identity.
Each UDP datagram is placed in its own IP packet and routed independently. Two datagrams sent in sequence may travel different paths, arrive in reverse order, be duplicated by a retransmitting link, or disappear. The receiving host uses the destination port to hand the data to the right process, which is how DNS resolvers, game servers and media clients share one machine. The protocol keeps no memory of earlier datagrams.
Checksums and Size
In IPv4 the checksum is optional, although RFC 8085 recommends enabling it. For ordinary IPv6 UDP traffic the checksum is required, with narrowly specified exceptions for some tunneling arrangements. RFC 8085 also advises applications to keep datagrams below the path MTU to avoid IP fragmentation, using conservative packet-size assumptions when the path is unknown and allowing for IP, UDP and any additional encapsulation headers. Fragmented datagrams are more exposed to loss, since losing any fragment discards the whole message.
Delivery, Ordering and Application Logic
The absence of transport guarantees does not mean a UDP application must be unreliable. It means reliability, where needed, is designed at the application layer. RFC 8085, the IETF guideline for UDP usage, states that applications requiring reliable delivery must implement an appropriate mechanism themselves, and that applications requiring ordered delivery must restore order themselves. In practice this means sequence numbers, acknowledgements, timers and retransmission logic written for the specific use case.
Different applications make different choices. A DNS client simply resends a query if no answer arrives within a timeout. A voice application numbers its packets, plays what arrives in time and conceals a missing frame rather than waiting for it, because a late audio sample is useless. A reliable file-transfer protocol needs a way to detect and recover missing data, which may use selective or cumulative acknowledgements. UDP packet loss is therefore handled according to what the data means, not according to a fixed transport rule.
Congestion control is also an application responsibility. RFC 8085 asks applications without a congestion-controlled transport to limit their sending rate, and to include a circuit breaker when they run on the general Internet. Keepalive traffic also needs care: it consumes network capacity and can maintain state in NAT devices or firewalls. The appropriate interval depends on the application, mapping lifetime and applicable protocol guidance.
UDP vs TCP and QUIC
TCP, specified in RFC 9293, offers a reliable, in-order byte stream. It opens a connection with a handshake, numbers every byte, acknowledges receipt, retransmits losses and adjusts its rate to congestion. These features cost round trips, and they can hold back later data behind a missing earlier segment, an effect known as head-of-line blocking.
QUIC, defined in RFC 9000, runs on top of UDP and rebuilds many TCP properties above the transport: ordered streams, reliability, flow control, congestion control and an integrated TLS 1.3 handshake. A gap in one stream does not automatically block delivery of data already received for another stream. A packet may carry frames from several streams, and congestion or application dependencies can still affect more than one. QUIC also supports connection migration across network paths. It shows that UDP is not an alternative to reliability but a foundation on which a different kind of reliability can be built.
| Property | UDP | TCP | QUIC |
|---|---|---|---|
| Connection setup | None | Three-way handshake | Combined transport and TLS handshake |
| Delivery guarantee | None at the transport level | Reliable, with retransmission | Reliable per stream |
| Ordering | None | Single ordered byte stream | Ordered within each stream |
| Congestion control | Application's responsibility | Built in | Built in |
| Encryption | Separate, for example DTLS | Separate, for example TLS | Integrated TLS 1.3 |
Where UDP Is Used
UDP suits traffic where each message stands alone or where timeliness outweighs completeness. DNS queries are typically a single question and a single answer. Real-time media in WebRTC calls travels in RTP packets over UDP, with sequence numbers and timestamps supplied by RTP rather than by the transport. STUN and TURN support UDP-based connectivity checks and relaying, with other transports available for relevant configurations. QUIC carries HTTP/3 over UDP. Many online games send frequent state updates where only the newest matters. SOCKS5 proxies can relay UDP through the UDP ASSOCIATE command defined in RFC 1928, while traditional HTTP CONNECT tunnels carry TCP. Newer proxy mechanisms such as CONNECT-UDP can support datagram forwarding when both client and proxy implement them.
Limitations and Considerations
UDP's simplicity has operational costs. Firewalls and corporate networks sometimes block or rate-limit UDP. Applications may then use alternatives: HTTP clients can fall back from HTTP/3 to HTTP over TCP, while WebRTC deployments may use a suitable TURN relay. QUIC itself does not become TCP. NAT mapping lifetimes vary, so connectivity protocols may send periodic traffic to keep mappings active. Because there is no handshake, the transport layer never confirms that the source address in a datagram is genuine; protocols built on UDP add their own validation where it matters.
Encryption is available but separate. DTLS, specified in version 1.3 by RFC 9147, provides authentication and confidentiality for datagram transports. It preserves datagram-oriented application delivery rather than supplying a reliable ordered byte stream. QUIC takes the other route and integrates TLS 1.3 directly. In both cases confidentiality is a property of the protocol stacked on UDP, not of UDP itself. Finally, UDP is not automatically faster than TCP. It avoids handshake and retransmission delay, but throughput still depends on the application's own rate control and on the network between the endpoints.