Skip to content
Early access 50% off every pass while we scale — licenses delivered instantly. Claim the offer
Interview Prep

TCP vs UDP: How to Explain the Difference in an Interview

The concise, interviewer-friendly way to compare TCP and UDP — with a comparison table, real-world examples and the follow-up questions you should expect.

Laptop showing source code on a white desk

“What’s the difference between TCP and UDP?” is one of the most common networking questions in software interviews, from campus placements to senior backend roles. The concepts are simple; what separates good answers is structure and the ability to handle follow-ups.

The 20-second answer

“TCP is connection-oriented: it sets up a connection with a handshake and guarantees that data arrives reliably and in order. UDP is connectionless: it just sends datagrams with no delivery or ordering guarantees, which makes it lighter and faster. We use TCP for web traffic, email and file transfer, and UDP for real-time things like video calls, gaming and DNS lookups.”

Say that first. Then go deeper only as far as the interviewer wants.

Side-by-side comparison

AspectTCPUDP
ConnectionConnection-oriented (three-way handshake)Connectionless
ReliabilityAcknowledgements and retransmissionNo guarantee; packets can be lost
OrderingDelivered in orderMay arrive out of order
Flow & congestion controlBuilt inNone (left to the application)
Header size20–60 bytes8 bytes
LatencyHigher overheadLower overhead and latency
Typical usesHTTP/1.1, HTTP/2, SMTP, SSH, FTPDNS, VoIP, video streaming, online games, QUIC (HTTP/3)

How TCP guarantees delivery

If the interviewer asks how, walk through these mechanisms:

  • Three-way handshake (SYN, SYN-ACK, ACK) to establish the connection and agree on initial sequence numbers.
  • Sequence numbers and acknowledgements, so the receiver can reorder segments and the sender knows what arrived.
  • Retransmission of segments that aren’t acknowledged within a timeout.
  • Flow control through the receive window, so a fast sender doesn’t overwhelm a slow receiver.
  • Congestion control (slow start, congestion avoidance) to back off when the network is saturated.

Why real-time apps prefer UDP

In a video call, a packet that arrives half a second late is useless — the moment has passed. Retransmitting it, as TCP would, only adds delay and makes the stream stutter. UDP lets the application decide: drop the late frame, smooth over the gap and move on. That is why voice, video and multiplayer games run over UDP, adding only the lightweight reliability they need.

TCP vs UDP follow-up questions to expect

“So is UDP unreliable?”

UDP itself makes no guarantees, but applications can add exactly the reliability they need on top. QUIC — the transport underneath HTTP/3 — runs over UDP and implements its own reliable, encrypted streams without TCP’s head-of-line blocking.

“Why does DNS use UDP?”

Most DNS queries and responses fit in a single small packet, so setting up a TCP connection would take longer than the lookup itself. DNS falls back to TCP for large responses and zone transfers.

“Give an example where TCP is the wrong choice.”

Live audio. Waiting for a lost packet to be resent causes audible gaps; it is better to skip it and keep the conversation flowing.

Common mistakes

  • Calling UDP “bad” or “insecure” — security is a separate layer (TLS, DTLS).
  • Treating ordering and reliability as the same guarantee.
  • Listing differences without examples. Always anchor to a real protocol or product.

Nail the one-line version, keep the table in your head and prepare for the QUIC and DNS follow-ups — that covers nearly every variation of this question.

Networking questions like this come up in almost every backend round. Practise with our bank of real interview questions, and read our guide on answering technical questions under pressure.

Put it into practice

Your next call, with a co-pilot that already knows the answer.

Cookie settings

We use essential cookies to run this site. With your permission, we would also use analytics and marketing cookies to understand how the site is used and to improve our ads. You can change your choice at any time from “Cookie settings” in the footer.

EssentialAlways on

Needed for the site to work and to remember your cookie choice. Always on.

  • Assisting AI — aai_consent · 180 days

Helps us understand which pages are useful so we can improve the site. Off unless you turn it on.

Not in use right now — we will ask you before adding any.

Used to measure and personalise our ads on other platforms. Off unless you turn it on.

Not in use right now — we will ask you before adding any.

Consent ID: — · Cookie PolicyPrivacy Policy