TECH_COMPARISON
TCP vs UDP: A Detailed Comparison for System Design
Compare TCP and UDP transport protocols — learn trade-offs in reliability, latency, ordering, and when to use each in system design.
TCP vs UDP
TCP and UDP are the two fundamental transport protocols of the internet. TCP provides reliable, ordered delivery at the cost of latency. UDP provides fast, best-effort delivery without reliability guarantees.
TCP: Reliability Above All
TCP establishes a connection with a three-way handshake, numbers every byte of data, requires acknowledgment of received data, and retransmits lost packets. The receiver always gets data in the correct order with nothing missing.
This reliability is essential for web browsing (every HTML byte matters), databases (every query result must be complete), and file transfers (a missing byte corrupts the file).
UDP: Speed Above All
UDP sends datagrams without establishing a connection, without acknowledgments, and without retransmission. If a packet is lost, the sender never knows. If packets arrive out of order, the receiver must deal with it.
This is perfect for real-time applications where speed matters more than completeness. In a video call, retransmitting a lost frame from 200ms ago is useless — the moment has passed. In a game, the latest position update matters; the one from 100ms ago does not.
Building on UDP
Modern protocols build reliability features on top of UDP selectively. QUIC (used by HTTP/3) provides reliable, ordered streams over UDP without TCP's head-of-line blocking. WebRTC uses UDP for media with selective retransmission for key frames only.
For more on networking fundamentals, see our concepts library and system design interview guide. Explore pricing for practice.
The Bottom Line
Use TCP when reliability and ordering are non-negotiable. Use UDP when low latency matters more than guaranteed delivery. Modern protocols like QUIC show that the future is building smart reliability on top of UDP.
GO DEEPER
Master this topic in our 12-week cohort
Our Advanced System Design cohort covers this and 11 other deep-dive topics with live sessions, assignments, and expert feedback.
// RELATED_COMPARISONS
REST vs GraphQL: A Detailed Comparison for System Design
Compare REST and GraphQL APIs — learn the trade-offs in flexibility, performance, caching, and developer experience for modern system design.
REST vs gRPC: A Detailed Comparison for System Design
Compare REST and gRPC for system design — explore trade-offs in performance, serialization, streaming, and language support for microservices.
GraphQL vs gRPC: A Detailed Comparison for System Design
Compare GraphQL and gRPC — explore trade-offs in flexibility, performance, schema design, and when to use each in modern distributed systems.
Monolith vs Microservices: A Detailed Comparison for System Design
Compare monolithic and microservices architectures — understand trade-offs in scalability, deployment, team structure, and operational complexity.
REST vs WebSocket: A Detailed Comparison for System Design
Compare REST and WebSocket protocols — understand when to use request-response vs persistent bidirectional connections in system design.
SOA vs Microservices: A Detailed Comparison for System Design
Compare SOA and microservices architectures — learn how they differ in service granularity, communication, governance, and data management.