What are the differences between UDP and TCP?
Although TCP and UDP are both forms of communication protocol, they work differently.
Use the table below to compare the main differences between UDP and TCP:
UDP | TCP | |
---|---|---|
How it works | Does not establish a connection | Establishes a connection |
Speed | Faster | Slower |
Reliability | Lower | Higher |
Resends lost packets? | No | Yes |
Ensures packets arrive in the right order? | No | Yes |
Flow Control | No – data packets may be dropped (lost) if the receiver is overwhelmed. | Yes – the receiver tells the sender how much space it has in its buffer to receive packets. TCP holds packets untill there is space. |
Data use | Lower | Higher |
What application is it used for inside your VPN tunnel? (You can still use either TCP or UDP for your VPN tunnel) |
|
|
Suitable for real-time applications? | Yes | No |
The key differences between UDP and TCP.
UDP is Faster Than TCP
We tested ExpressVPN and NordVPN, the two top VPNs for 2023, to see how their speeds compare when using the OpenVPN protocol with UDP and TCP.
For each VPN and OpenVPN type, we connected from our US headquarters to a server in the US, UK, and Australia and measured our download speeds. Here are our results:
ExpressVPN (Mbps) | NordVPN (Mbps) | |||||
---|---|---|---|---|---|---|
Country | UDP | TCP | % Loss | UDP | TCP | % Loss |
US | 94 | 91 | 3 | 92 | 94 | 0 |
UK | 62 | 47 | 24 | 85 | 16 | 81 |
AUS | 75 | 47 | 37 | 67 | 4 | 94 |
Speed test data comparing UDP and TCP on international connections.
As this data shows, UDP is usually faster than TCP, and the difference becomes greater as the distance to the server increases. That’s because TCP delivers data packets in an ordered and error-checked stream, and any incorrect or missing data has to be re-requested from the sending computer, which adds delays.
Additionally, a UDP packet contains more payload than a TCP packet (because of its smaller header), more data can fit into a given network connection pipe (say 100Mbs) and so you get increased throughput.
For this reason, UDP is often used over TCP for activities such as streaming or gaming.
Using TCP, the back-and-forth communications between the sender and receiver means each message has to travel further, and the VPN’s average speeds decrease.
Using ExpressVPN, UDP was 24% faster connecting from the US to the UK, and 37% faster connecting to Australia.
The difference was even clearer using NordVPN. We lost 81% of our download speed connecting to the UK using TCP, and 94% connecting to Australia. We did find that TCP was marginally faster than UDP when connecting to a NordVPN server in the same country, though.
TCP Consumes More Data Than UDP
TCP uses more data than UDP because it includes more information in the header of each data packet. This makes TCP more reliable, but less efficient than UDP.
Every data packet that’s sent over the internet has a header, which is like writing the address on an envelope. It contains the information required to get the data to the right place, and any additional information needed for the protocol.
Both UDP and TCP show the source and destination ports for the data, the length of the data packet, and the checksum in the header. However, TCP also includes additional information to guarantee correct delivery.
EXPERT TIP: The checksum is a calculation that’s carried out on the data twice: before it is sent and after it is received. If the result is different at the receiving end, it means the data has been corrupted in transit.
Here’s how the headers for UDP and TCP compare:
UDP | TCP | |
---|---|---|
Header size | 8 bytes | 20 bytes+ |
Header contents (both UDP and TCP) |
|
|
Header Contents (TCP only) | No additional header data |
|
Data comparing the difference between UDP and TCP headers.
As this table shows, when compared to UDP, TCP uses more data to manage your data transfers when you send information over the internet.
TCP also involves more communications between the sender and receiver. That’s because the receiver ACKs (Acknowledges) every other packet when it is received using TCP, and any lost packets are re-sent. As a result, TCP uses more data than UDP.
In our analysis of VPN data usage, we measured the amount of extra data that is used by a VPN using TCP compared to UDP. Here’s a summary of our results:
OpenVPN with UDP | OpenVPN with TCP | |
---|---|---|
Data increase compared to not using a VPN | 17.23% | 19.96% |
Data usage test results comparing how much data is used by UDP and TCP.
If you are on a mobile data plan where you pay by the gigabyte or you have a fixed data cap, you’ll use your allowance faster if you use TCP.
TCP Is Slightly More Secure Than UDP
Neither UDP nor TCP are designed for security. They’re used to send data packets over the internet, and those packets could be plain text or they could be encrypted. Other protocols or applications higher up the communications stack usually take care of security.
Because packets are sequenced and acknowledged in TCP, it’s harder for a hacker to inject malicious data than it is with UDP.
In practical terms, neither protocol has security concerns when used with a VPN. Both TCP and UDP support the security and privacy features used to keep you safe.