TCP vs UDP: How Does the Transport Layer Deliver Data?
Explore how TCP and UDP deliver data at the Transport Layer. Understand the trade-off between TCP’s reliability and UDP’s speed.
In the last article, we walked through the seven layers of the OSI model and saw how data is encapsulated as it moves from the application down to the physical wire. One layer deserves a closer look on its own: the Transport Layer.
This is the layer responsible for delivering data between applications, and two of the most important protocols at this layer are TCP and UDP. Both solve the same basic problem, but they take very different approaches.
What Does the Transport Layer Actually Do?
Before comparing TCP and UDP, it helps to understand the problem the Transport Layer is designed to solve. The Network Layer focuses on delivering packets from one IP address to another, but it does not know which application on the destination device should receive the data.
For example, your laptop might have a browser, an email client, and a video call running at the same time, all using the same device and IP address. So how does the incoming data reach the correct application?
That is where the Transport Layer comes in:
- It provides process to process delivery by using port numbers to identify the correct application on the destination device.
- It also provides different approaches to data delivery, allowing applications to choose between reliable and ordered communication or faster communication with fewer guarantees.
This is where TCP and UDP take different paths.
TCP: Reliable, Ordered, and Connection-Oriented

TCP (Transmission Control Protocol) is designed for applications where data needs to arrive reliably, completely, and in the correct order.
To achieve this, TCP uses several mechanisms:
- Establishes a connection first using a three-way handshake: SYN, SYN-ACK, and ACK.
- Numbers each segment, allowing the receiver to reassemble the data in the correct order.
- Acknowledges received data, allowing the sender to identify missing data and retransmit it.
- Provides flow and congestion control, helping prevent the sender from overwhelming the receiver or the network.
This reliability comes with some additional overhead. The connection setup takes time, acknowledgments generate additional traffic, and lost data may need to be retransmitted. However, this tradeoff is useful when correctness is more important than speed. For example, when downloading a file, you would generally prefer to wait a little longer and receive the complete file rather than receive incomplete or corrupted data.
TCP's data unit is called a segment.
Common use cases include:
- Web browsing with HTTP and HTTPS
- Email protocols such as SMTP
- File transfers
- Applications where reliable and ordered delivery is important
UDP: Fast, Simple, and Connectionless

UDP (User Datagram Protocol) takes a simpler approach to data transmission. Unlike TCP, it does not establish a connection or guarantee that the data will reach the destination.
UDP works by:
- Not requiring a handshake, allowing data transmission to begin immediately.
- Not guaranteeing delivery or ordering, meaning lost or out of order data is not automatically retransmitted or corrected.
- Using a smaller and simpler header, which reduces protocol overhead and helps keep communication lightweight.
This makes UDP useful when low latency is more important than guaranteed delivery. For example, during a live voice or video call, receiving an old packet several seconds later is usually less useful than continuing with newer data. A small amount of packet loss may be acceptable if it keeps the communication responsive.
UDP's data unit is called a datagram.
Common Use Cases include:
- DNS lookups
- Online gaming
- Voice and video communication
- Live streaming and other latency sensitive applications
TCP vs UDP at a Glance
Feature | TCP | UDP |
|---|---|---|
Connection | Connection oriented | Connectionless |
Reliability | Reliable delivery with retransmission | No delivery guarantee |
Ordering | Data is delivered in order | No ordering guarantee |
Speed | More overhead | Lower overhead |
Data unit | Segment | Datagram |
Common uses | Web browsing, email, file transfer | DNS, gaming, voice and video communication |
So, Which One Should You Use?
The choice between TCP and UDP depends on what matters more to the application: reliable delivery or low latency.
Choose TCP over UDP
- Use TCP when every piece of data must arrive correctly and in the right order.
- Problem it solves: It prevents missing, duplicated, or out-of-order data from affecting the application by ensuring reliable and ordered delivery.
Choose UDP over TCP
- Use UDP when speed and low latency are more important than guaranteed delivery.
- Problem it solves: It avoids the delay caused by retransmissions and waiting for lost packets, allowing real-time applications to continue with minimal interruption.
Wrapping Up
TCP and UDP solve the same basic problem but take different approaches. TCP focuses on reliable and ordered delivery, while UDP prioritizes speed and low latency. Neither is universally better because the right choice depends on what the application needs. Understanding this trade off makes it easier to decide when to use TCP and when UDP is the better fit.
Enjoyed reading this content? Let the author know!
Your likes, comments, shares, and saves help creators reach more builders.
Loading recommendations
Loading article