Networking 8 min read

TCP vs UDP: The Two Ways Data Travels Across the Internet

One guarantees delivery, the other is fast but unreliable. Here's how TCP and UDP work and when each protocol is used.

March 25, 2026

What Are TCP and UDP?

When you send data over the internet—whether you're loading a webpage, streaming a video, or playing an online game—that data needs to travel from your device to a server and back. But there are two different ways this can happen: TCP and UDP.

Think of it like shipping a package. You have two options:

  • TCP (Certified Mail): The post office confirms every step—pickup, transit, delivery. You get a tracking number and proof of delivery. Slower, but guaranteed to arrive.
  • UDP (Regular Mail): You just drop it in the mailbox and hope it gets there. Faster and cheaper, but no guarantee it arrives or arrives in order.

Both have their place. Let's break down when and why you'd use each one.

Advertisement

TCP: The Reliable One (Transmission Control Protocol)

TCP is like having a conversation on the phone. Before you start talking, you say "Hello?" and wait for the other person to say "Hello!" back. Then you take turns speaking, and if someone didn't hear you clearly, you repeat yourself.

How TCP Works (The Three-Way Handshake)

Before any data is sent, TCP establishes a connection using what's called a three-way handshake:

  1. 1. SYN (Synchronize): Your computer says "Hey server, can we talk?"
  2. 2. SYN-ACK (Synchronize-Acknowledge): The server replies "Sure, I'm ready!"
  3. 3. ACK (Acknowledge): Your computer confirms "Great, let's start!"

Only after this handshake does data transmission begin.

Key Features of TCP

  • Guaranteed delivery – If a packet is lost, TCP resends it automatically
  • Ordered delivery – Packets arrive in the exact order they were sent
  • Error checking – TCP detects corrupted data and requests retransmission
  • Flow control – Adjusts speed so the receiver isn't overwhelmed
  • Connection-oriented – Must establish a connection before sending data

When TCP Is Used

TCP is perfect when accuracy matters more than speed. Here are common examples:

  • Web browsing (HTTP/HTTPS) – Loading websites, downloading files
  • Email (SMTP, IMAP, POP3) – Sending and receiving emails
  • File transfers (FTP, SFTP) – Uploading/downloading files
  • Remote access (SSH, RDP) – Controlling another computer remotely
  • Database queries – Any situation where you can't afford lost data

If you're reading a webpage, you don't want half the images or text to be missing. TCP makes sure everything arrives intact.

Advertisement

UDP: The Fast One (User Datagram Protocol)

UDP is like shouting across a crowded room. You just yell your message and hope the other person hears it. No handshake, no confirmation, no retries. If they miss it, oh well—move on.

Sounds unreliable, right? It is! But that's the point. UDP is fast because it skips all the error-checking and confirmation steps that TCP does.

How UDP Works

UDP doesn't establish a connection. It just sends data immediately:

  1. 1. Create the packet – Bundle up the data
  2. 2. Send it – Fire it off to the destination
  3. 3. Forget about it – Don't wait for confirmation

That's it. No handshake, no acknowledgment, no guarantees.

Key Features of UDP

  • No guaranteed delivery – Packets can be lost, and UDP won't retry
  • No ordering – Packets can arrive out of order
  • No error correction – Corrupted packets are discarded
  • Connectionless – No handshake needed, just send
  • Low overhead – Minimal processing = faster transmission

When UDP Is Used

UDP is perfect when speed matters more than perfection. Here are common examples:

  • Online gaming – Fast-paced games need instant updates, slight packet loss is okay
  • Live video streaming – Twitch, YouTube Live, video calls (a few dropped frames are fine)
  • Voice over IP (VoIP) – Phone calls, Discord, Zoom (a tiny audio glitch beats a 2-second delay)
  • DNS lookups – Quick queries (if it fails, just retry)
  • Network broadcasts – Sending data to multiple devices at once
  • IoT devices – Smart home sensors sending frequent updates

If you're on a video call and one word gets garbled, you don't want the system to pause and resend it—that would cause a delay. Better to just keep the conversation flowing.

TCP vs UDP: Side-by-Side Comparison

Here's a quick breakdown of the key differences:

Feature TCP UDP
Connection Connection-oriented Connectionless
Reliability Guaranteed delivery No guarantee
Ordering Arrives in order Can arrive out of order
Speed Slower (overhead) Faster (no overhead)
Error Checking Yes (resends) Basic (discards)
Header Size 20 bytes (larger) 8 bytes (smaller)
Use Case Accuracy critical Speed critical
Examples Web, Email, FTP Gaming, Streaming, VoIP

Advertisement

Real-World Examples to Remember

TCP = Certified Mail

You're mailing your friend a $100 check. You want proof it arrived. You use certified mail with tracking and a signature requirement. It takes longer and costs more, but you know it got there safely.

This is TCP. Web browsers use TCP to load pages because you can't afford to have half the page missing.

UDP = Shouting at a Concert

You're at a loud concert and you yell "This song is awesome!" to your friend. Maybe they hear you, maybe they don't. You're not going to tap them on the shoulder and repeat yourself—the moment has passed.

This is UDP. Online games use UDP because if a position update packet is lost, the next update is coming in 16 milliseconds anyway (60 frames per second). No point in resending old data.

Why Video Streaming Uses UDP

Imagine you're watching a live sports game. One frame gets corrupted or lost. Would you rather:

  • Option A (TCP): The video pauses, requests the missing frame, waits for it to arrive, then continues. You see a buffering spinner.
  • Option B (UDP): The video skips a single frame (you won't even notice) and keeps playing smoothly.

Obviously, Option B is better. That's why YouTube, Netflix, and Twitch use UDP-based protocols (or similar low-latency protocols).

Common TCP and UDP Ports (For the A+ Exam)

The CompTIA A+ exam will test you on which services use TCP vs UDP. Here are the most important ones to memorize:

TCP Ports (Connection-Oriented Services)

  • Port 20/21 - FTP (File Transfer Protocol)
  • Port 22 - SSH (Secure Shell - remote access)
  • Port 23 - Telnet (Insecure remote access)
  • Port 25 - SMTP (Email sending)
  • Port 80 - HTTP (Web browsing)
  • Port 110 - POP3 (Email retrieval)
  • Port 143 - IMAP (Email retrieval)
  • Port 443 - HTTPS (Secure web browsing)
  • Port 3389 - RDP (Remote Desktop Protocol)

UDP Ports (Connectionless Services)

  • Port 53 - DNS (Domain Name System lookups)
  • Port 67/68 - DHCP (Automatic IP assignment)
  • Port 69 - TFTP (Trivial File Transfer Protocol)
  • Port 123 - NTP (Network Time Protocol)
  • Port 161/162 - SNMP (Network monitoring)
  • Port 514 - Syslog (System logging)

Pro tip: DNS (Port 53) can use both TCP and UDP. It usually uses UDP for quick lookups, but switches to TCP for large responses (like zone transfers).

What You Need to Know for the CompTIA A+ Exam

Here's what the exam will test you on:

Key Facts to Memorize

  • TCP is connection-oriented – Uses a three-way handshake (SYN, SYN-ACK, ACK)
  • UDP is connectionless – Just sends data without establishing a connection
  • TCP guarantees delivery – Resends lost packets
  • UDP does not guarantee delivery – Fire and forget
  • TCP is slower but reliable – Best for accuracy
  • UDP is faster but unreliable – Best for speed
  • Web browsing uses TCP (HTTP/HTTPS)
  • DNS queries use UDP (usually)
  • Video calls use UDP (VoIP, Zoom)
  • Email uses TCP (SMTP, IMAP, POP3)

Common Exam Questions

  • Q: Which protocol guarantees packet delivery?
    A: TCP
  • Q: What is the three-way handshake?
    A: SYN → SYN-ACK → ACK
  • Q: Which protocol would online gaming use?
    A: UDP (speed over reliability)
  • Q: Which protocol is used for DNS lookups?
    A: UDP (usually port 53)
  • Q: Why is UDP faster than TCP?
    A: No handshake, no error checking, no retransmission

Final Thoughts

TCP and UDP are like two different philosophies. TCP says "I need to make sure every single packet arrives perfectly," while UDP says "I just need to get data flowing as fast as possible."

Neither is better than the other—they're designed for different purposes. Loading a webpage? Use TCP. Playing an online game? Use UDP. The internet wouldn't work without both.

Remember the key difference: TCP is like a phone call (two-way, reliable, ordered), and UDP is like a radio broadcast (one-way, fast, no guarantees). Once you understand that, everything else makes sense. 📡📞