1. Home
  2. VPN / Privacy
We are reader supported and may earn a commission when you buy through links on our site. Learn more

TCP vs UDP: What They Are + Difference Between TCP and UDP

TCP and UDP are connection protocols that are used to establish the way data gets exchanged over an Internet connection. If you already know what IP stands for (i.e. Internet Protocol), then you’re already in the know, as both TCP and UDP have been developed on top of it.

However, you’d be wrong to think that they’re virtually the same; although both TCP and UDP “have a say” in the way your data is sent/received on the Internet, they’re actually wildly different and for this reason, they’re used for different purposes.

TCP UDP comparison

To put it shortly, let’s just say that you inadvertently use these two protocols every day when you access the Internet, which makes them paramount in the way your device communicates with the open Web (and devices connected to it) and vice versa.

Since both TCP and UDP are built upon the Internet Protocol, you might want to understand more about IP before jumping straight into TCP/UDP introductory lessons. You know, you need to learn how to walk before you can run.

What is an IP address?

IP, which is short for Internet Protocol, is the very backbone on top of which the Internet as we know it was built. Its importance can be easily figured out by the fact that every device is assigned a unique IP address in order for it to access the Internet.

The address used to consist only of numbers and decimals. To be more specific, an IPv4 address can be formed out of four individual numbers, each of which can have a value between 0 and 254. IPv4 gave us a total range of 4.3 billion unique IP addresses.

Inevitably, the Internet started to get to the point where no new unique IP addresses could be generated, which is when the IPv6 system came in to save the day. Public IPv6 addresses use hexadecimal digits and each contains 128 bits, which means that instead of base 10 (0 through 10) they use base 16 (0 through 10 plus “a” through “f”).

With the help of the IPv6 system, the total range of public IPv6 addresses we could have is 340 undecillion (3.4 * 10^28). If that’s impossible to wrap your head around, check out how IPv4 and IPv6 addresses look like below:

  • IPv4 address example:
  • IPv6 address example: fe80:0db8:0412:2001:3c5e:0000:10a9

Although the ultimate goal is for IPv6 to replace IPv4, nowadays the two protocols work in conjunction.

IP addresses allow Internet-enabled devices to locate, communicate with one another, and exchange information. Sharing data, streaming a video, or sending emails wouldn’t be possible without an IP address. Everything you do online can be transcribed into data.

To assure optimal functionality, the IP splits this data into smaller chunks so it can manage it better. We refer to these data chunks as packets. However, these packets don’t only hold the information they’re supposed to carry, but also the destination IP address of the device they need to reach. This destination is called the header.

After a packet leaves your device, it heads towards a gateway, which scans for your packet’s destination IP address on its domain. It’s worth mentioning that the gateway can only see a given set of IP addresses on the Internet.

So, if the gateway can’t find the address in its domain, it just sends the packet to a different gateway, and this operation keeps going on until the packet reaches a gateway that can detect the destination IP address specified in the header and sends it to the device associated with that address.

Another thing worth noting is that the fact that your data is split into small packets means that it doesn’t necessarily need to arrive in order, or even use the same route, for that matter. As a matter of fact, packets usually try to find the fastest route they can every time.

Last, but not least, you should know that the Internet Protocol isn’t format-specific, making it ideal for any form of data, whether we’re talking video, images, audio, emails, instant messages, or even gaming.

What is TCP?

TCP, which stands for Transmission Control Protocol, is one of the main protocols used by the Internet protocol suite. It came before UDP and was used to enable programs and devices alike to exchange information over a network.

You may notice that sometimes it’s paired up with IP, and referred to as TCP/IP, but it means the same thing (i.e. TCP and TCP/IP are the exact same thing).

As explained above, data is split into small packets and sent to other devices in this fragmented form, possibly even on different routes. TCP was invented for the need to reassemble these packets back into their original form.

TCP waits for all the packets to arrive, counts them, checks them for error using a checksum, acknowledges packets that made it to their destination and asks the originating computer to resend those that didn’t make it the first time. After receiving all packets, TCP re-assembles them into the original data and delivers it to an appropriate application (e.g. email client, picture viewer, video player).

This process happens very fast nowadays, and it ensures that the data arrives on the recipient’s machine exactly as it was on the sender device, with no ulterior alterations. Furthermore, it involves constant communication on both ends, as the process can actually be described as a continuous back-and-forth between the participating devices until the data arrives and is 100% confirmed.

It goes without saying that this constant communication between devices puts an awful strain on TCP, as any lost or corrupt packet can halt the process until the missing bit arrives safely at its destination. However, TCP doesn’t have to do everything by itself, so UDP was invented shortly after.

To put it shortly, TCP:

  • Makes sure no packets are dropped
  • Asks for packets to be resent if it detects any missing ones
  • Sends packets in order so that they can be easily reassembled
  • Most popular Internet protocol
  • Slower than UDP because it needs to make sure every packet arrives
  • Fit for websites, emails, FTP (File Transfer Protocol), P2P file sharing

What is UDP?

UDP, short for User Datagram Protocol, is an alternative to TCP, so it’s safe to assume that essentially they carry the same task. However, they’re also wildly different at the same time, since TCP is quite meticulous at checking packet data, whereas UDP is a bit more careless.

Imagine two employees handling letters at a mail sorting station: TCP is the one that carefully examines each letter and withholds all communication until every letter arrives, while UDP just checks letters for integrity and forwards them to their destinations, all the while dropping any letter that didn’t arrive and not asking for a resend.

So it’s safe to say that UDP is faster, but why would you want to sacrifice speed at the expense of losing data along the way? Well, basically there are some applications where losing packets isn’t exactly a tragedy.

For instance, if you’re using a VoIP client and talking with someone, you might notice the occasional frame loss, or a bit of stutter in the audio, which is most of the time easy to ignore, and therefore not crucial. The same goes for gaming, where you may notice the game stutter, or rubberband every now and then. You just resume playing and that’s the end of it since UDP just drops packets that got lost in transit.

In other words, UDP:

  • Is faster than TCP and uses fewer resources
  • Doesn’t necessarily send packets in order
  • Drops any missing packets to speed up the connection
  • The sender has no way to find out if packets have been dropped
  • Mostly used for video streaming, VoIP, gaming, and live broadcasts

TCP and UDP in VPN usage

Nowadays, more and more VPNs start to adopt WireGuard or craft their proprietary protocol to be used, but many of them rely on OpenVPN because after all these years it’s still reliable, fast, and secure.

However, what you may not know is that OpenVPN works with both TCP and UDP, and most of the time it lets you choose between those two protocols. While this may sound like a big decision to make (data integrity versus speed), the real issue lies someplace else.

While using a VPN, you may not be able to notice any huge difference between TCP and UDP in terms of speed. However, if your connection needs to bypass a firewall, that’s when things change, mainly because these protocols operate on different ports, and some firewalls may block default ports for certain types of traffic.

Hence why VPN providers let you choose between TCP and UDP. If you notice that your connection doesn’t work on one protocol, you can just switch to the other and cross your fingers. Some VPN providers offer you advanced settings where you can also choose a custom port for your connection to avoid firewalls.

Difference between TCP and UDP

  • TCP is the most widely used protocol on the internet
  • All sent data makes it to the recipient, no packet loss guarantee
  • Packets are sent in order
  • Requires more resources, which makes it slower, too.
  • UDP is used for gaming, video streaming, VoIP, live broadcasts
  • Sender won’t know if a packet is missing (not received)
  • Packets are not necessarly sent in order
  • Fewer resources needed, faster.

TCP vs UDP: Conclusion

To wrap things up, TCP and UDP are quite similar protocols, in that they make sure your data makes it to its destination safely and without being modified somewhere along the way.

TCP performs several checks while transmitting data and is generally more drastic about not losing packets, which makes it great for websites, emails, instant messages, pictures, and file sharing.

UDP just checks if the destination is correct and checks the packets’ integrity, but doesn’t ask the sender to resend any lost packets, and just drops them instead, which means you’ll have a faster connection, but you may drop packets along the way. UDP is mostly used for gaming, VoIP, streaming video, and broadcasting live content, where losing a few packets shouldn’t affect the end result too much.

How to get a FREE VPN for 30 days

If you need a VPN for a short while when traveling for example, you can get our top ranked VPN free of charge. NordVPN includes a 30-day money-back guarantee. You will need to pay for the subscription, that’s a fact, but it allows full access for 30 days and then you cancel for a full refund. Their no-questions-asked cancellation policy lives up to its name.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.