Skip to content
IP-025 IP Addresses & Networks

What is the difference between TCP and UDP?


title: "What is the difference between TCP and UDP?" card_id: "IP-025" status: "complete" source_document: "https://docs.google.com/document/d/1vwkamUvc9XOsWDOFS2FawqxEmGQlXSY9WI48Kg_Dcno/edit?usp=drivesdk"


What is the difference between TCP and UDP?

TCP and UDP are two different ways of transporting data across an IP network.

TCP stands for Transmission Control Protocol.

UDP stands for User Datagram Protocol.

Both work alongside IP addressing, and both can use port numbers to direct traffic to the correct application or service.

The main difference is how they manage communication.

TCP is connection-oriented.

Before the main data is exchanged, the two systems normally establish a connection using a three-way handshake.

One system asks to connect.

The other responds.

The first system confirms the response.

Once that handshake is complete, the TCP connection is established.

TCP then keeps track of the data being sent.

It divides the data into manageable pieces, numbers them and checks that they arrive.

If something goes missing, TCP can arrange for it to be sent again.

If pieces arrive in the wrong order, TCP puts them back into the correct order before passing the data to the application.

That makes TCP useful where complete and correctly ordered delivery matters.

Traditional web traffic, email, file transfers and many remote-access services commonly use TCP.

UDP works differently.

It’s described as connectionless because it doesn’t establish the same kind of managed connection before sending data.

A device can simply send an individual UDP datagram towards the destination.

UDP itself doesn’t check that it arrived.

It doesn’t automatically resend missing data.

And it doesn’t guarantee that several datagrams will arrive in the same order they were sent.

That doesn’t mean UDP communication can’t receive replies.

An application can send a UDP request and receive a UDP response. The point is that UDP itself doesn’t create and manage the conversation in the same way as TCP.

Because UDP has less built-in management, it can be useful where speed and timing matter more than recovering every missing piece of data.

Voice and video calls, online games and many DNS queries commonly use UDP.

Applications can also add their own checks, acknowledgements and recovery mechanisms on top of UDP.

Modern protocols such as QUIC, which is used by HTTP/3, do exactly that. They use UDP underneath but provide additional connection management and reliability themselves.

So UDP shouldn’t simply be described as unreliable rubbish while TCP is treated as the good version.

They’re designed for different jobs.

TCP prioritises an organised, managed and reliably delivered stream of data.

UDP sends individual datagrams with less built-in checking and control.

Neither protocol automatically encrypts the information being carried.

TCP traffic can be encrypted or unencrypted.

UDP traffic can also be encrypted or unencrypted.

Encryption is provided by other protocols or applications using TCP or UDP.

Seeing TCP or UDP in a log therefore tells you how the traffic was transported.

It doesn’t, by itself, prove which application was used, what the traffic contained or what the person behind it was doing.


Keep moving

Where this question leads

These links explain why the next page may matter, rather than presenting an undifferentiated list.