TCP vs UDP — What’s the Difference Between Them?

TCP vs UDP — What’s the Difference Between Them?

1 Star2 Stars3 Stars4 Stars5 Stars (24 votes, average: 4.33 out of 5)
Loading...

TCP and UDP are both ways that you transmit data across networks — but as much as they’re the same, they’re also different. Here’s what to know about these different internet protocols and how they work….

TCP vs UDP — what is the difference between TCP and UDP?

When it comes to understanding TCP vs UDP — or what’s known as the transmission control protocol and the user datagram protocol — there’s quite a bit to know. In the most basic sense, it comes down to understanding that they’re variations of the same thing and that they operate in different ways.

In a nutshell, they’re similar (yet different) internet protocols that transfer data. More specifically, TCP and UDP are both communication protocols. But there’s more to them than just that. To help you better understand, we’ll cover what TCP and UDP are individually — their similarities, their individual purposes, and how they work. After that, we’ll highlight the difference between TCP and UDP in a handy table.

Don't make the same mistakes

Yahoo, Equifax, Home Depot,

LinkedIn, and Ericsson did!

Get our free 15-point checklist and

avoid the same costly pitfalls.

Please Select Your Country
  • Afghanistan
  • Albania
  • Algeria
  • Andorra
  • Angola
  • Antigua & Deps
  • Argentina
  • Armenia
  • Aruba
  • Australia
  • Austria
  • Azerbaijan
  • Bahamas
  • Bahrain
  • Bangladesh
  • Barbados
  • Belarus
  • Belgium
  • Belize
  • Benin
  • Bermuda
  • Bhutan
  • Bolivia
  • Bosnia Herzegovina
  • Botswana
  • Brazil
  • Brunei
  • Bulgaria
  • Burkina
  • Burundi
  • Cambodia
  • Cameroon
  • Canada
  • Cape Verde
  • Central African Rep
  • Chad
  • Chile
  • China
  • Colombia
  • Comoros
  • Congo
  • Congo {Democratic Rep}
  • Costa Rica
  • Croatia
  • Cuba
  • Curaçao
  • Cyprus
  • Czech Republic
  • Denmark
  • Djibouti
  • Dominica
  • Dominican Republic
  • East Timor
  • Ecuador
  • Egypt
  • El Salvador
  • Equatorial Guinea
  • Eritrea
  • Estonia
  • Eswatini
  • Ethiopia
  • Fiji
  • Finland
  • France
  • Gabon
  • Gambia
  • Georgia
  • Germany
  • Ghana
  • Greece
  • Grenada
  • Guatemala
  • Guinea
  • Guinea-Bissau
  • Guyana
  • Haiti
  • Honduras
  • Hungary
  • Iceland
  • India
  • Indonesia
  • Iran
  • Iraq
  • Ireland {Republic}
  • Israel
  • Italy
  • Ivory Coast
  • Jamaica
  • Japan
  • Jordan
  • Kazakhstan
  • Kenya
  • Kiribati
  • Korea North
  • Korea South
  • Kosovo
  • Kuwait
  • Kyrgyzstan
  • Laos
  • Latvia
  • Lebanon
  • Lesotho
  • Liberia
  • Libya
  • Liechtenstein
  • Lithuania
  • Luxembourg
  • Macedonia
  • Madagascar
  • Malawi
  • Malaysia
  • Maldives
  • Mali
  • Malta
  • Marshall Islands
  • Mauritania
  • Mauritius
  • Mexico
  • Micronesia
  • Moldova
  • Monaco
  • Mongolia
  • Montenegro
  • Morocco
  • Mozambique
  • Myanmar
  • Namibia
  • Nauru
  • Nepal
  • Netherlands
  • New Zealand
  • Nicaragua
  • Niger
  • Nigeria
  • Norway
  • Oman
  • Pakistan
  • Palau
  • Panama
  • Papua New Guinea
  • Paraguay
  • Peru
  • Philippines
  • Poland
  • Portugal
  • Qatar
  • Romania
  • Russian Federation
  • Rwanda
  • St Kitts & Nevis
  • St Lucia
  • Saint Vincent & the Grenadines
  • Samoa
  • San Marino
  • Sao Tome & Principe
  • Saudi Arabia
  • Senegal
  • Serbia
  • Seychelles
  • Sierra Leone
  • Singapore
  • Slovakia
  • Slovenia
  • Solomon Islands
  • Somalia
  • South Africa
  • South Sudan
  • Spain
  • Sri Lanka
  • Sudan
  • Suriname
  • Sweden
  • Switzerland
  • Syria
  • Taiwan
  • Tajikistan
  • Tanzania
  • Thailand
  • Togo
  • Tonga
  • Trinidad & Tobago
  • Tunisia
  • Turkey
  • Turkmenistan
  • Tuvalu
  • Uganda
  • Ukraine
  • United Arab Emirates
  • United Kingdom
  • United States
  • Uruguay
  • Uzbekistan
  • Vanuatu
  • Vatican City
  • Venezuela
  • Vietnam
  • Yemen
  • Zambia
  • Zimbabwe

Contact details collected on InfoSec Insights may be used to send you requested information, blog update notices, and for marketing purposes. Learn more...

But first, let’s better get a handle on what an internet protocol is to set the foundation for the topic.

What Is the Internet Protocol?

The internet protocol (IP), a type of network protocol, is a set of rules that dictate how data sends or transmits to an intended recipient via the local network, across subnets or even the Internet. So, for example, whenever you send data from your web browser to a website — like when you order dog treats in bulk from your favorite pet supply website — you do so via the internet protocol.

In a roundabout way, internet protocol data transmissions allow you to do everything you do online — from tweeting on social media and researching recipes to sending emails with images or your favorite cat videos. Essentially, it’s the foundation of the internet.

IP, TCP, and UDP Are All Protocols Within the Layers of the OSI Model

I mentioned that IP is a network protocol. The network is just one of seven layers of the ISO’s open systems interconnection (OSI) model. The model serves as the vertical framework and standards that guide how information exchanges among computing systems. The seven layers of the OSI model are:

  1. Physical layer
  2. Data link layer
  3. Network layer
  4. Transport layer
  5. Session layer
  6. Presentation layer
  7. Application layer

Typically, this is visualized vertically in descending order with the physical layer being the lowest layer. As such, it traditionally looks something like this:

A graphic that breaks down the 7 layers of the OSI model
An illustration that outlines the 7 layers of the ISO’s open systems interconnection model.

TCP and UDP, on the other hand, are two of the protocols that fall within the transport layer of the OSI model. Now, there are actually a variety of protocols out there that fall within the seven layers and serve different functions — and many are built upon one another. We’re not going to get into all of those today since the purpose of this article is to help you understand TCP vs UDP.

Before we can get into the nitty-gritty of discussing the difference between TCP and UDP, you first need to understand how the internet protocol works. I say this because TCP and UDP both rely on IP. This will serve as a foundation for helping to explain the other two concepts.

How the IP Works to Transfer Data

Regardless of what you’re sending, the data travels back and forth across the internet through a process known as routing. As you can probably guess, this process involves the use of routers or gateways to regulate traffic. According to a TechRepublic article by network engineer and tech writer Brien Posey, routers are typically for similar networks, whereas gateways help to bridge dissimilar networks.  

Now, to ensure that the data reaches the intended recipient, every individual device has its own assigned IP address — much like you have a specific address for your house or apartment. But instead of 123 Main Street, your IP address on the internet might look something like 250.250.250.250 (if you’re using a standard IPv4 address). This 32-bit number consists of a series of subnets (segments of numbers that are divided by periods) — each of which contains up to three digits (for up to a total of 12 digits or 15 characters, including the periods).

Of course, this looks different for IPv6 IP addresses, which are 128-bit numbers and look akin to this: 2001:0db8:85a3:0000:0000:8a2e:0370:7334 (this is an example IPv6 address from Wikipedia).  

Before transferring your data, the IP breaks it down into smaller PDUs — these are known as packets (for TCP) or datagrams (for UDP). Packets is the most commonly used term for data units in networking. This breakdown of data happens with all IP data transfers — TCP and UDP alike. Each of these individual little bundles of data is slapped with a label (header) that tells the delivery person where it needs to go and where it was sent from.

The data is transferred routers or gateways that have lists information for different IP addresses (and their corresponding domains) across the internet. The info transfers from one gateway to the next until one of them recognizes the package or datagram’s destination.

Now, just keep in mind that this is a (highly) simplified breakdown of how IP works. Just keep this illustration in mind because I’m going to come back to it later and apply TCP and UDP as the delivery methods.

If you’re wondering where the domain name system (DNS) fits into all this (since it’s essentially what connects domains with their corresponding IP addresses), just know that it’s related but separate. For example, the domain name system can use UDP for DNS requests. However, we’re not going to get into all of that here because that’s just a whole separate process and the focus of this article is honing in on the differences between TCP vs UDP. So, we’ll have to cover the DNS system more in depth in a future article.

The Internet Protocol is the Delivery Service of the Internet

Okay, let’s put all of this into a little context. Think of the internet protocol like the FedEx, DHS, or USPS of the internet — but with a bit of a twist (I’ll explain more shortly). With these types of mail delivery services, you can choose to send packages via basic delivery, or you can choose to have someone sign for the packages upon arrival to ensure they’ve reached the right person. The internet protocol works much the same way but for digital data transmissions.

Now, continuing with the delivery service analogy, imagine that your mom wants to send you a BUNCH of home baked items: cookies, breads, dehydrated fruits — you name it. (You lucky devil.) To do this, she’d need to have your address to ensure the oversized package get delivered to your doorstep successfully. Otherwise, those delicious treats could end up in the hands of your least favorite neighbors, Greg and Jill (and nobody wants that).

So, in this case, your mom would package everything up, label the package with your address (header), and request for her favorite delivery company to come get ‘em. (Again, I’m really simplifying things here — cut me some slack.) However, she winds up having to break down the box into a series of smaller labeled boxes (packets or datagrams) because it’s just too much to handle.

Once the packages leave her house, they wind up at the transfer station (gateway) to make their way to the next delivery point closest to the destination. There, the packages make their way from station to station (gateway to gateway) until they get to the one that knows your exact address.

Now, imagine that delicious package is instead data that’s transmitting across the internet. Now, what happens to those packages at this point will vary depending on whether the delivery occurs via TCP or UDP. I’ll explain what I mean by that momentarily — but first, let’s get a primer on what TCP and UDP are and what each data transmission method entails.

TCP vs UDP: Everything You Need to Know About These Protocols

What Is TCP?

TCP stands for transmission control protocol, which is a type of connection-oriented data communication method. It was designed to help establish reliable connections on virtually any network — even those that are unreliable. TCP, which is dependent upon IP, is part of the transport layer of the ISO’s open system interconnection (OSI) model. This means it’s a transport layer communication protocol.

But how do you know if you’re using TCP? You know that buffering symbol that pops up sometimes when you’re trying to load a high-quality video on your favorite video website? That’s frequently a sign that the data you’re receiving is being transmitted via TCP.

Basically, the goal of TCP is to be an error-free method of data transmission. The transmission control protocol helps to:

  1. Ensure the recipient receives all of the data that’s sent (via a delivery receipt), and
  2. Keep the data transmissions organized by ensuring that packets are received by the recipient in their intended order.

TCP does this by establishing a reliable connection that helps it to verify that packets are received successfully. Basically, if the data arrives as intended, in the order it’s supposed to, then it receives a confirmation from the recipient. If not, then the TCP will have the sender re-send the data again.   

The TCP protocol was first defined in 1980 by the Internet Engineering Task Force (IETF) in its RFC 761. It was later obsoleted by RFC 793 in 1981. Historically, it’s been a very common method of data transmission — one that you likely use on a daily basis as you go about your day on the internet.

However, it’s not perfect and may not be the most suitable protocol to use in all cases. This is where UDP (or other communication protocols) comes into play. (More on UDP momentarily.)

How TCP Works in Exchanging Data

The transmission control protocol requires establishing a connection via a three-way handshake before transferring data packets from the server to the client. The three-way handshake process, which starts with the exchange of SYN, SYN-ACK, and ACK messages (known as flags) between these entities, helps to ensure that a reliable connection is made between them. It looks something like this:

TCP vs UDP graphic: An illustration of the three-way handshake as part of the TCP connection process
An illustration of the three-way handshake

The three messages are the following:

  • SYN — synchronize
  • SYN-ACK — synchronize-acknowledgement
  • ACK — acknowledge

Of course, there’s a number of other flags that can be exchanged after that point — but we won’t get into all of that now. Let’s just continue with the purpose of the process. Once that connection is established, each segment of data that’s sent from the client to the server is followed by an ACK flag to confirm receipt of the data packet.

This all sounds great in theory. But what’s a real-world example of TCP in action that you can see? As of June 2016, TCP was being used by the internet video streaming service Netflix. (However, I’m not sure if they still do or if they use another protocol now as they never responded to my press request.)

What Is UDP?

As we mentioned earlier, UDP stands for user datagram protocol. While it’s like TCP in that it’s a type of transport layer communication protocol, it’s different because it’s a connectionless communication protocol — meaning that no connection has to be established prior to sending your data packets (or, more specifically, datagrams).

With UDP, no three-way handshake is necessary before transmitting data to the intended recipient. So, all or some of the data might arrive — and it may (or may not) arrive in the order as intended. As such, it’s often described as a “best effort.”

There’s a great analogy that a stackexchange.com forum user named Mike Robinson used to describe the user datagram protocol:

UDP puts a message into a bottle and tosses it into the sea. It might never arrive. It might arrive before or after some other bottle. You will never know if it arrived. You don’t even know if the intended recipient is alive at all, much less pulling bottles out of the water. The only way you’ll know if your message was heard is if another bottle washes up on your shoreline, and you manage to grab it before it sinks.”

UDP, much like TCP, has been around for a while. The concept of user datagram protocol was first defined in IETF RFC 768 in 1980. While TCP has long ruled as being the go-to protocol, UDP is gaining traction as speed and network performance become a priority.

How UDP Works in Exchanging Data

The benefit of UDP over TCP is that it offers lower latency, but the catch is that it also can result in the loss of some data and data integrity. And unlike with TCP, if some of that data is missing, the sender won’t re-send it because they have no way to follow up to make sure that you received everything.

All of this is to say that UDP isn’t an error-free way to exchange data. So while it’s a faster data transfer process than TCP, the caveat is that you don’t receive the data exactly how it was sent originally, and there could be data missing (and you’d never know it).

UDP is ideal for “live” situations in which data transfers need to occur in real time without delay. Some possible examples of UDP use cases include online video game play and audio or video calls.

A Summary of the Differences Between TCP and UDP

Basically, both TCP and UDP are protocols that help determine how data is exchanged between two entities. The biggest difference between the TCP vs UDP delivery methods boils down to:

  • If and how they connect. TCP is all about the connection. It’s a protocol that establishes reliable connections — even on unreliable networks — before transmitting data. UDP is a connectionless protocol, meaning that it’ll send data regardless of whether it can confirm the recipient is there to receive it.
  • Data completeness and reliability. TCP prioritizes data integrity and guaranteed delivery, whereas UDP prioritizes speed at the expense of data loss.
  • Data transmission speeds. TCP is the heavy-weight contender whereas UDP is the light-weight division champ. The first has a series of processes that it follows to ensure the job is done well, whereas the latter is all about getting the job done quickly.
  • Applications for each protocol. TCP is best for delivering higher quality data streams that can buffer (like video streaming services), whereas UDP is best for live data transfer applications like audio and video chats, online gaming, DNS requests, etc.

TCP vs UDP: Differences in Terms of Data Delivery (an Example)

Let’s think back to the analogy of your mom’s home-baked goodies and apply TCP and UDP as the delivery methods. When the delivery company is moving the packages of baked goods, the packages will get delivered via different delivery routes to their destinations. They may or may not arrive in the intended order or condition that they were sent, and they may just be dropped off without verifying that you’re there to receive them.

With TCP, the smaller packets of data (baked items) arrive and it’s like there’s a personal delivery assistant who assembles them back into exactly the precise order they were sent to you by your mom. So, nothing from the original package is changed or missing — and you have to sign for the package upon arrival. This way, your mom can guarantee that you will receive your goodies. If one gets lost, she’ll then know and can try to resend it.

With UDP, on the other hand, the datagrams (baked items) can get modified or rearranged a bit in terms of order. And when they reach their destination, they’re just left on your doorstep — no one signs for them, and no service reassembles everything for you. This means that if you only receive some of the packages of baked goods, that’s too bad because your mom doesn’t know and isn’t going to resend the missing ones. Also, because you got a whole bunch of packages, you won’t necessarily even realize that one or two might be missing.

TCP vs UDP Applications: When Is One Method Better Than the Other?

If you want to reliable data transmission stream, TCP is for you. TCP ensures that you receive everything exactly as it was sent, and you don’t care if there might be a delay or a connection refusal and have to try again, then you’d want to go with TCP. But if you care more about speed and want to receive info more quickly, regardless of whether it’s received exactly as it was sent — or if packets of data be missing — then UDP works just fine.

Basically, choosing between the two protocols boils down to what you’re trying to accomplish. Some examples of when UDP would be preferable to TCP includes using real-time video and audio chats online or playing multi-player or battlegrounds in live online games.

TD;DR — The Key Differences Between TCP vs UDP

Look, I get it. You’re busy and there’s a lot to know about TCP and UDP. Both of these protocols have their advantages and serve specific uses in our digital world. So, to quickly summarize for those of you who are in a hurry, here’s a table that breaks down the differences between TCP and UDP.

TCP (Transmission Control Protocol)UDP (User Datagram Protocol)
TCP is a connection-oriented communication protocol.UDP is a connectionless communication protocol.
TCP data units are known as packets.UDP data units are commonly referred to as datagrams (although they’re sometimes called packets as well).
TCP rearranges data packets to be received in their intended order.UDP sends datagrams independently, meaning that they may arrive in a different order.
Uses a three-way handshake to establish reliable connections.UDP doesn’t use a handshake process.
TCP confirms data delivery receipts.UDP doesn’t use delivery receipts.
TCP results in higher latency.UDP is designed for faster data transmission.
TCP guarantees data delivery by prioritizing data integrity, completeness, and reliability.UDP prioritizes speed and often results in data loss.
TCP is ideal for reliable data transmissions.UDP is ideal for real-time data transfers and streaming to avoid delay.

About the author

Casey is a writer and editor with a background in journalism, marketing, PR and communications. She has written about cyber security and information technology for several industry publications, including InfoSec Insights, Hashed Out, Experfy, HackerNoon, and Cybercrime Magazine.