User Datagram Protocol (UDP)
UDP in Networking (Overview)
The User Datagram Protocol (UDP) is a connectionless transport-layer protocol defined in RFC 768. It provides a best-effort (“no guaranteed delivery”) service: UDP sends independent datagrams without establishing a session, and it does not guarantee delivery, ordering, or duplicate protection. Applications must handle any reliability or sequencing they require.
Why UDP is “lightweight”
UDP’s minimal design includes only a small fixed header and intentionally avoids connection setup and built-in reliability mechanisms. As a result, UDP can reduce latency and overhead compared with transport protocols that maintain connection state (e.g., TCP).
Key learning terms (within UDP)
- Datagram
- Connectionless
- Best-effort
- Transport-layer
- Port number
Footnotes
-
RFC 768 — User Datagram Protocol - Summarizes UDP’s connectionless, best-effort, no ordering/reliability characteristics. ↩ ↩2
How a UDP datagram is sent and delivered
- 1Step 1
The application chooses a destination Port number and sends a payload.
- 2Step 2
UDP constructs an 8-byte header with source port, destination port, length, and checksum fields.
- 3Step 3
IP handles addressing/routing; UDP does not create a connection or manage reliability.
- 4Step 4
Because the service is best-effort, datagrams can be dropped or arrive out of order.
- 5Step 5
The receiver uses the destination port to deliver the payload to the correct application process.
- 6Step 6
If the application needs reliability or ordering, it must implement them itself (since UDP doesn’t provide them).
UDP service characteristics (what UDP does—and does not—provide)
UDP is defined as an unreliable connectionless transport on top of an unreliable network-layer service.2 Concretely:
-
No connection establishment (connectionless)
UDP does not perform a handshake to set up state between endpoints before sending.2 -
No guaranteed delivery / no retransmissions (unreliable, best-effort)
UDP does not guarantee that datagrams arrive; loss and duplication are possible and not handled by UDP itself.2 -
No guaranteed ordering
Because datagrams are independent, they may arrive out of sequence at the receiver.2 -
Integrity checking via checksum (error detection, not recovery)
UDP includes a Checksum for integrity verification. UDP can detect corruption but does not automatically retransmit or repair lost data.2
Implications for application design
Since UDP doesn’t provide end-to-end reliability or ordering, many real-time applications either:
- tolerate occasional loss/reordering, or
- implement their own selective reliability, buffering, timestamps, or forward error correction at the application layer.
[Pro Tip]{type="tip" title="Pro Tip"} If you need “every byte, in order,” UDP is the wrong tool by itself—use TCP or add application-layer reliability. UDP is ideal when freshness matters more than perfect completeness.2 {type="tip"}
Footnotes
-
The User Datagram Protocol — Computer Networking: Principles, Protocols and Practice - States UDP is defined in RFC 768 and highlights no delivery guarantee and no out-of-sequence protection. ↩ ↩2 ↩3 ↩4
-
RFC 768 — User Datagram Protocol - Summarizes UDP’s connectionless, best-effort, no ordering/reliability characteristics. ↩ ↩2 ↩3 ↩4
-
UDP: User Datagram Protocol [RFC 768] - Notes connectionless nature, lack of handshaking, and possibility of loss/out-of-order delivery. ↩ ↩2 ↩3
-
What is UDP? | Azion - Discusses UDP as connectionless without handshake/ack/retransmission/ordering and notes typical real-time use. ↩
UDP header format (8 bytes) and fields
A UDP packet consists of a fixed 8-byte UDP header followed by the application payload.2 The header has four 16-bit fields:
| Field | Size | Meaning |
|---|---|---|
| Source Port | 16 bits | Sender’s application port (optional in some cases) |
| Destination Port | 16 bits | Receiver’s application port |
| Length | 16 bits | Total length of UDP header + data |
| Checksum | 16 bits | Integrity check for header+payload (error detection) |
These fields are documented in common explanations of UDP structure and align with standard UDP packet layout discussions.3
UDP pseudo-header (checksum computation detail)
For checksum computation, UDP uses information from the IP header (often described as a pseudo-header) to strengthen error detection. This pseudo-header is not transmitted as part of the UDP datagram.
[Warning]{type="warning" title="Warning"} The presence of a UDP checksum means UDP can detect some corruption, but it does not guarantee delivery, ordering, or recovery from loss. Applications still must handle missing datagrams.2 {type="warning"}
Footnotes
-
User Datagram Protocol - Wikipedia - Describes UDP datagram structure and the four header fields. ↩ ↩2
-
UDP: User Datagram Protocol [RFC 768] - Notes connectionless nature, lack of handshaking, and possibility of loss/out-of-order delivery. ↩ ↩2
-
RFC 768 — User Datagram Protocol - Summarizes UDP’s connectionless, best-effort, no ordering/reliability characteristics. ↩ ↩2
-
User Datagram Protocol (UDP) Packet Header — NetworkLessons - Explains UDP header fields and checksum behavior using concrete port/length examples. ↩
-
The User Datagram Protocol — Computer Networking: Principles, Protocols and Practice - States UDP is defined in RFC 768 and highlights no delivery guarantee and no out-of-sequence protection. ↩
UDP vs TCP (high-level behavioral differences)
Directionally compares core guarantees that matter in transport choice.
UDP in practice: where it’s used
Because UDP minimizes overhead and avoids connection/state management, it’s widely used in low-latency and real-time contexts (where waiting for retransmissions can increase perceived delay).
Common examples include:
- DNS lookups (typically over UDP on port 53)
- VoIP (voice over IP)
- Online gaming
- Real-time media streaming (often built atop UDP using RTP/RTCP)
These use cases and motivations (speed/low overhead with tolerable loss) are repeatedly highlighted in networking resources that discuss UDP’s role in real-time applications and its lack of delivery guarantees.3
UDP and modern transport: QUIC (context)
Many modern web systems use QUIC, which is built to provide reliability and congestion control while still running over UDP. QUIC’s motivation is often described as improving the web experience by adding features that UDP itself lacks.
Footnotes
-
What is UDP? | Azion - Discusses UDP as connectionless without handshake/ack/retransmission/ordering and notes typical real-time use. ↩
-
UDP: User Datagram Protocol [RFC 768] - Notes connectionless nature, lack of handshaking, and possibility of loss/out-of-order delivery. ↩
-
UDP Protocol Explained: Meaning, Header Format, IoT Uses & Security - Lists common UDP use cases and explains UDP’s lightweight rationale. ↩
-
Comparing QUIC and UDP for Enterprise Networks — Lightyear - Explains typical use where QUIC adds reliability/congestion control while leveraging UDP for real-time transport. ↩
FAQ / Edge cases
UDP usage decision roadmap (conceptual)
Define application requirement
Step ADo you need ordered, loss-free delivery—or can you tolerate loss and prefer low latency?"
Choose transport semantics
Step BIf you can tolerate loss/reordering, UDP often fits; otherwise consider TCP or a reliability layer."
Design application-layer behavior
Step CAdd sequencing, timeouts, selective retransmission, or buffering as needed for your use case."
UDP Term Deck
Knowledge Check
Which statement best describes UDP?