UDP
What is it?
UDP is a lightweight internet protocol that sends data fast without guaranteeing delivery or order, trading reliability for speed.
Explain like I'm 5
Why was it created?
Some uses care more about speed than perfect delivery. UDP was created as a minimal, low-overhead alternative to TCP's reliability machinery.
Where is it used?
- Video and voice calls
- Online gaming
- DNS lookups
- Live streaming
Why should developers care?
UDP powers real-time media, gaming, and DNS, so understanding when to choose it over TCP is core networking knowledge.
How does it work?
UDP sends independent packets (datagrams) with minimal overhead and no connection setup, acknowledgements, or retransmission. If a packet is lost or arrives out of order, UDP doesn't fix it — the application handles that if needed.
Real-world example
A video call uses UDP so a momentarily lost packet just causes a tiny glitch rather than freezing the call to re-send old data.
Common use cases
- Real-time audio/video
- Gaming
- DNS queries
- Latency-sensitive data
Advantages
- Very low latency
- Minimal overhead
- No connection setup
- Good for real-time data
Disadvantages
- No delivery guarantee
- No ordering
- App must handle loss if needed
- Can be misused where reliability is required
When should you use it?
When speed and low latency matter more than guaranteed, ordered delivery.
When should you avoid it?
When every byte must arrive correctly and in order — use TCP.
Alternatives
Related terms
Interview questions
Beginner
- What is UDP?
- How does it differ from TCP?
Intermediate
- Why does video calling use UDP?
- What does UDP not guarantee?
Senior
- When would an app add reliability on top of UDP?
- Why does DNS commonly use UDP?
Common misconceptions
- "UDP is unreliable so it's bad" — for real-time media, dropping a late packet is better than waiting to resend it.
- "UDP and TCP are interchangeable" — they make opposite trade-offs between speed and reliability.
Fun facts
- UDP stands for User Datagram Protocol.
- Newer protocols like QUIC build reliability on top of UDP to get speed without giving up delivery.
Timeline
- 1980 — UDP specified as a core internet protocol
Learning resources
Quick summary
UDP is a fast, low-overhead protocol that sends data without guaranteeing delivery or order, ideal for real-time media and gaming.
Cheat sheet
- Fast, connectionless protocol
- No delivery/order guarantee
- Low latency, low overhead
- Best for real-time media (vs TCP)