Handbooks  /  TCP vs UDP
Engineering~9 min readComparison
Head to Head

TCP vs UDP: guaranteed delivery, or raw speed?

TCPvsUDP

Both carry your data across the internet, but they make opposite promises. TCP swears every byte arrives, in order, no matter what — and pays for that promise in latency. UDP promises nothing and just throws packets at the wire — which, for a live video call, turns out to be exactly what you want.

01

The one distinction that decides everything

TCP is connection-oriented and reliable: it opens a connection with a handshake, numbers every byte, acknowledges what arrives, retransmits what doesn’t, and delivers the stream to the application in order — with flow and congestion control so it doesn’t overwhelm the receiver or the network. UDP is connectionless and best-effort: it wraps your data in a tiny header and fires it off with no handshake, no acknowledgements, no retransmission, and no ordering. If a UDP packet is lost or arrives out of order, the protocol neither knows nor cares — that’s the application’s problem, if it’s a problem at all.

→ The rule

If every byte must arrive intact and in order (a web page, a file, an email), you want TCP’s guarantees. If low latency matters more than completeness and a lost packet is better dropped than resent late (live audio, video, gaming), you want UDP’s speed.

02

Head to head

DimensionTCPUDP
ConnectionHandshake, stateful connectionConnectionless — just send
ReliabilityGuaranteed — ACKs + retransmitNone — packets may vanish
OrderingIn-order delivery guaranteedNo ordering — may arrive shuffled
Flow / congestion controlYes — adapts to receiver & networkNo — sends as fast as you ask
Header overheadLarger (20+ bytes, more state)Tiny (8 bytes)
LatencyHigher — handshake, ACKs, retransmit waitsLower — no waiting on delivery
On packet lossStalls to retransmit (head-of-line blocking)Drops it and keeps going
Typical useHTTP, email, file transfer, DB connectionsVideo/voice, gaming, DNS, streaming
03

When to use each

Reach for TCP

  • Web traffic (HTTP/HTTPS), APIs, anything request/response
  • File transfer, email, database connections
  • Any payload where a single missing byte corrupts the result
  • When you want reliability handled for you, for free
  • Long-lived connections that can absorb handshake cost

Reach for UDP

  • Live audio and video, VoIP, video calls
  • Online gaming — position updates where stale data is useless
  • DNS lookups — one small request/response, retry if needed
  • Real-time telemetry and streaming where latency rules
  • When your app can tolerate (or handle) its own loss
04

The modern answer: reliability built on UDP (QUIC)

The two aren’t a permanent fork. Modern transport increasingly builds the reliability it needs on top of UDP rather than using TCP. QUIC — the transport under HTTP/3 — runs over UDP and re-implements connection setup, reliability and congestion control in user space, so it gets TCP-grade guarantees while dodging TCP’s baked-in limitations (notably head-of-line blocking, below) and enabling faster connection setup. So "TCP vs UDP" at the app layer is often really "a reliable protocol vs a bare one," and UDP has quietly become the flexible foundation that new reliable protocols are built on.

→ The cheap default

For ordinary request/response traffic, use TCP (or HTTP over it) — reliability for free, and it’s what everything speaks. Reach for UDP when you have a specific, measured need for low latency over completeness, or when you’re building a real-time protocol and want to control reliability yourself.

05

Head-of-line blocking: why real-time picks UDP

TCP’s in-order guarantee has a sharp edge called head-of-line blocking. Because TCP must hand bytes to the application in order, a single lost packet stalls everything behind it: the receiver has the later packets buffered but can’t deliver them until the missing one is retransmitted and arrives. For a file, that’s fine — you wait a few milliseconds. For a live video call, it’s a disaster: the frame you’re stuck waiting to retransmit is already stale by the time it arrives, and meanwhile the picture freezes.

UDP has no such rule. If a packet is lost, the ones after it are delivered immediately, and the app simply skips the missing audio sample or video frame — a tiny glitch nobody notices, versus a frozen call everybody hates. That’s the core reason real-time media runs on UDP: for live data, late is worse than lost. (And it’s exactly the blocking QUIC was designed to eliminate by multiplexing independent streams over UDP, so a loss in one stream doesn’t stall the others.)

→ The trade you’re actually making

TCP trades latency for the guarantee that nothing is missing or misordered. UDP trades that guarantee for the ability to never wait — which is priceless when stale data is worthless and glitches are cheaper than freezes.

06

A worked scenario: loading a page vs a video call

Loading this web page is a TCP job. The HTML, CSS and JavaScript must arrive complete and in order — a single dropped byte in a script breaks it, and there’s no such thing as "skip the missing part of the file." TCP’s handshake and retransmission cost a few milliseconds you won’t notice, and in exchange you get a perfect copy of every resource. This is why the web runs on TCP (and QUIC, its UDP-based successor).

A video call is a UDP job. Frames of audio and video pour in dozens of times a second, and if one packet drops, you do not want the protocol to freeze the call while it fetches a now-useless old frame — you want it to skip that frame and keep the conversation live. A momentary blip is invisible; a two-second freeze while TCP retransmits is maddening. So the app sends over UDP and accepts (or conceals) the occasional loss. Same internet, opposite protocol, because one payload must be perfect and the other must be prompt.

→ The pattern generalizes

Must-be-complete, order-sensitive data → TCP. Must-be-fast, loss-tolerant, real-time data → UDP. When you need both (modern web, low-latency-but-reliable), that’s what QUIC-on-UDP is for.

Frequently asked

Quick answers

What's the difference between TCP and UDP?

TCP is connection-oriented and reliable: it handshakes, acknowledges and retransmits data, and delivers it in order with flow and congestion control — at the cost of higher latency. UDP is connectionless and best-effort: it fires packets with no guarantees of delivery or ordering and almost no overhead, so it is faster but may lose or reorder data. TCP is for data that must arrive intact; UDP is for data that must arrive fast.

Why is UDP used for video and gaming?

Because for real-time media, late data is worse than lost data. TCP’s in-order guarantee causes head-of-line blocking — a single lost packet stalls everything behind it while it is retransmitted, freezing a live call. UDP simply skips the lost packet and keeps going, so a momentary glitch replaces a freeze. Low latency matters more than completeness, which is exactly UDP’s trade-off.

What is head-of-line blocking?

A delay caused by in-order delivery: because TCP must hand bytes to the application in order, one lost packet blocks all the packets received after it from being delivered until the missing one is retransmitted and arrives. It is fine for files but harmful for live media. QUIC (HTTP/3) was designed to avoid it by multiplexing independent streams over UDP.

Does HTTP/3 use TCP or UDP?

HTTP/3 runs on QUIC, which is built on UDP. QUIC re-implements reliability, ordering and congestion control in user space on top of UDP, giving TCP-grade guarantees while avoiding TCP’s head-of-line blocking and enabling faster connection setup. So modern web transport increasingly uses UDP as the foundation for a reliable protocol, rather than TCP directly.

TCP vs UDP · Vibe Engines · 2026
Finished this one? 0 / 160 Handbooks done

Explore the topic

See this alongside everything else on the same subject — handbooks, system designs, challenges and tools, in one place.