TCP vs UDP: What Is the Difference?
Two Ways to Move Data Across a Network
TCP and UDP are the two main transport protocols that carry your data across the internet, and they make opposite trade-offs. TCP guarantees that data arrives complete and in order, while UDP just sends data as fast as it can without those guarantees. Almost everything you do online uses one or the other, often both at different moments.
Both protocols use port numbers to deliver traffic to the right application, and you can see which ports are open on a host with our Port Scanner.
Connection-Oriented vs Connectionless
TCP (Transmission Control Protocol) is connection-oriented: it establishes a connection first and then guarantees that data arrives complete and in the right order, retransmitting anything lost. UDP (User Datagram Protocol) is connectionless: it sends data without setting up a connection or confirming delivery, which makes it faster but unreliable. TCP trades speed for reliability, and UDP trades reliability for speed.
The TCP Three-Way Handshake
Before sending data, TCP establishes a connection with a three-message exchange called the three-way handshake: SYN (the client requests a connection), SYN-ACK (the server acknowledges and responds), and ACK (the client confirms). Once this completes, both sides have agreed to communicate and data transfer begins. UDP skips this step entirely, which is part of why it is faster and also why it is the target of SYN-flood style attacks on TCP.
Which Is Faster, and When to Use Each
UDP is generally faster because it has no connection setup, no acknowledgments, and no retransmission overhead. TCP is slower because it ensures reliable, ordered delivery. So the choice depends on the job: TCP is used where complete, in-order data matters, such as web browsing (HTTP/HTTPS), email, and file transfers. UDP is used where speed matters more than perfect delivery, such as DNS queries, voice and video calls, live streaming, and online gaming.
Do TCP and UDP Use Ports?
Yes. Both TCP and UDP use port numbers (0 to 65535) to direct traffic to the correct application, and the same number can refer to a separate TCP port and UDP port. For example HTTPS commonly uses TCP port 443, while DNS commonly uses port 53 over UDP, falling back to TCP for large responses. Knowing which ports a service listens on is the basis of a port forwarding rule or a port scan.
Frequently Asked Questions
What is the difference between TCP and UDP?
TCP, or Transmission Control Protocol, is connection-oriented: it establishes a connection and guarantees that data arrives complete and in order. UDP, or User Datagram Protocol, is connectionless: it sends data without setting up a connection or guaranteeing delivery, which makes it faster but less reliable. TCP trades speed for reliability, and UDP trades reliability for speed.
What is the TCP three-way handshake?
The three-way handshake is how TCP establishes a connection before sending data, using three messages: SYN (the client requests a connection), SYN-ACK (the server acknowledges and responds), and ACK (the client confirms). Once this exchange completes, both sides have agreed to communicate and data transfer begins. UDP skips this entirely, which is part of why it is faster.
Is TCP or UDP faster?
UDP is generally faster because it has no connection setup, no acknowledgments, and no retransmission overhead, it just sends. TCP is slower because it ensures reliable, ordered delivery through handshakes, acknowledgments, and error recovery. The right choice depends on whether your application values guaranteed delivery (TCP) or low latency (UDP).
What is TCP used for and what is UDP used for?
TCP is used where complete, in-order data matters, such as web browsing (HTTP and HTTPS), email, and file transfers. UDP is used where speed matters more than perfect delivery, such as DNS queries, VoIP calls, live streaming, and online gaming. Many systems use both depending on the task.
Do TCP and UDP use ports?
Yes, both TCP and UDP use port numbers to direct traffic to the correct application on a device, and the same number can refer to a separate TCP port and UDP port. For example, HTTPS commonly uses TCP port 443, while DNS commonly uses port 53. You can check which ports are open on a host with a port scanner.