16 Languages, One Live Classroom Cisco, Cyber & Cloud
HSR Sector 6 · Bangalore +91 96110 27980 Mon–Sat · 09:30–20:30
Networking Fundamentals · 8 min read · Updated 29 August 2026

TCP vs UDP: how they differ, and when each one is used

TCP is reliable and connection-oriented; UDP is neither. TCP opens a session with a three-way handshake, numbers every byte, retransmits whatever goes missing, and hands the application an ordered stream. UDP attaches an 8-byte header and sends. That is the whole difference — everything below is what it costs you.

Every comparison of these two protocols says the same thing: TCP is reliable, UDP is fast, use TCP for web pages and UDP for video calls. That was good advice for about twenty-five years. It is now wrong in a way that matters, because the web itself has been moving to UDP since 2022 — HTTP/3 runs over QUIC, and QUIC runs over UDP. If you learned the old rule you will misread a packet capture.

So it is worth understanding what the two protocols actually do, rather than memorising which applications sit on top of them.

The handshake is the whole story

Before a TCP connection carries a single byte of your data, three packets cross the network. The client sends a SYN with an initial sequence number. The server replies SYN-ACK, acknowledging the client's number and offering its own. The client sends ACK. Only then does payload move.

That costs you one full round trip. On a link to a server in the same city, maybe 5 ms — irrelevant. On a satellite link at 600 ms round trip, it is most of a second before anything useful happens. This single fact explains most of the design decisions that follow.

TCP three-way handshake compared with UDP fire-and-forget TCP exchanges SYN, SYN-ACK and ACK before sending data, costing one round trip. UDP sends the datagram immediately with no setup. TCP — session first UDP — data first Client Server SYN seq=x SYN-ACK seq=y ack=x+1 ACK ack=y+1 DATA one round trip spent before any payload Client Server DATA no setup, no acknowledgement, no way to know it arrived
The practical test in a capture: if you see SYN, SYN-ACK and ACK before payload, it is TCP. If the first packet on the conversation is already carrying data, it is UDP.

Twenty bytes against eight

A TCP header is 20 bytes minimum and can reach 60 with options. A UDP header is 8 bytes, always — source port, destination port, length, checksum. That is the entire protocol.

Twelve bytes sounds trivial, and on a file transfer it is. On voice traffic it is not. A G.729 voice packet carries 20 bytes of audio. Wrapping that in TCP rather than UDP would add more header than payload — and the retransmissions would be useless anyway, because audio that arrives late is audio you have already played silence over. This is why RTP runs on UDP and always will.

Side by side

PropertyTCPUDP
ConnectionConnection-oriented — a session is established before any data movesConnectionless — the first packet is the data
Setup costThree-way handshake (SYN, SYN-ACK, ACK) before byte oneNone. Send and forget
Header size20 bytes minimum, up to 60 with options8 bytes, fixed
Delivery guaranteeGuaranteed. Lost segments are retransmittedNone. A lost datagram is simply gone
OrderingSequence numbers reassemble out-of-order segmentsNo ordering. Datagrams arrive however they arrive
Flow controlSliding window, advertised by the receiverNone
Congestion controlYes — backs off when the network is loadedNone, unless the application implements it
Error handlingChecksum plus retransmissionChecksum only — corrupt datagrams are discarded silently
Broadcast / multicastNot possible — TCP is strictly point-to-pointSupported
Typical useHTTP/1.1 and HTTP/2, SSH, SMTP, FTP, TelnetDNS, DHCP, SNMP, TFTP, Syslog, RTP, HTTP/3

Where the old rule breaks

TCP's reliability applies to the connection, not to individual streams inside it. HTTP/2 multiplexes many requests over one TCP connection, so a single lost segment stalls all of them while it is retransmitted — including requests whose data already arrived. That is head-of-line blocking, and on a lossy mobile link it is brutal.

QUIC solves it by dropping to UDP and rebuilding reliability per-stream, in user space, where it can be changed without waiting for operating-system kernels to be updated. So HTTP/3 is not "the unreliable web". It is reliability moved up a layer to get better behaviour under loss — and, as a bonus, a secure connection in fewer round trips. When you next capture browser traffic and see a flood of UDP on port 443, that is what you are looking at.

Port numbers worth memorising

CCNA tests these directly, and the two that catch people out are DNS and HTTPS — both appear under TCP and UDP, for different reasons.

PortProtocolService
20, 21TCPFTP — data and control
22TCPSSH
23TCPTelnet
25TCPSMTP
53TCP and UDPDNS — UDP for queries, TCP for zone transfers and large responses
67, 68UDPDHCP — server and client
69UDPTFTP
80TCPHTTP
123UDPNTP
161, 162UDPSNMP — polling and traps
443TCP and UDPHTTPS over TCP; HTTP/3 and QUIC over UDP
514UDPSyslog

Telling them apart on a live device

On IOS, an access list with separate TCP and UDP lines will show you which is actually being matched:

R1# show ip access-lists TRAFFIC-CHECK
Extended IP access list TRAFFIC-CHECK
    10 permit tcp any any eq 443 (18422 matches)
    20 permit udp any any eq 443 (95170 matches)
    30 permit udp any any eq 53 (2011 matches)
    40 permit ip any any

Five times more UDP than TCP on port 443 is not an anomaly — that is HTTP/3 doing its job. A few years ago line 20 would have been almost empty.

Choosing between them

The question is not "do I want reliability" — everyone wants reliability. It is what should happen to data that arrives late.

If late data is still useful, use TCP. A file transfer that finishes a second slowly is fine; a file transfer missing a byte is not. If late data is worthless, use UDP and handle loss yourself. A voice packet that turns up after its playback slot cannot be used no matter how correct it is, so spending a round trip to recover it makes the call worse, not better. Everything else follows from that one question.

Frequently asked

What is the main difference between TCP and UDP?

TCP is connection-oriented and reliable: it establishes a session with a three-way handshake, numbers every byte, retransmits anything lost, and delivers data to the application in order. UDP does none of that. It puts an 8-byte header on your data and sends it. If a datagram is lost, corrupted or arrives out of order, UDP neither knows nor cares — that is left to the application. The practical consequence is that TCP trades latency for certainty, and UDP trades certainty for latency.

Is UDP faster than TCP?

UDP has lower overhead, which is not the same thing as being faster. The header is 8 bytes against TCP's 20, and there is no handshake, so the first datagram carries payload immediately instead of waiting one round trip. But on an uncongested link the raw throughput is similar. UDP feels faster because it never pauses to retransmit or wait for an acknowledgement — it simply keeps sending. On a lossy link UDP will finish sooner and deliver less.

Why does HTTP/3 use UDP if TCP is more reliable?

Because TCP's reliability is applied to the whole connection, which causes head-of-line blocking: one lost segment stalls every stream multiplexed over that connection, even streams whose data arrived intact. HTTP/3 runs over QUIC, which sits on UDP and reimplements reliability per-stream in user space. So HTTP/3 is not less reliable than HTTP/2 — it moved reliability up a layer to get better behaviour under loss, and it can establish a secure connection in fewer round trips.

Which protocol does DNS use, TCP or UDP?

Both, on port 53. Ordinary queries and responses use UDP because a lookup is a single small request and a single small answer, and retrying is cheaper than establishing a session. DNS switches to TCP when the response will not fit comfortably in a datagram — historically over 512 bytes — and for zone transfers between servers, which are bulk data and need reliability. This is a favourite CCNA exam question precisely because the answer is not one protocol.

How do I tell whether traffic is TCP or UDP on a Cisco device?

The protocol is named in the IP header, so any tool that reads it will tell you. On IOS, 'show ip access-lists' displays matches per line so a permit tcp and permit udp entry will show which is being hit; 'debug ip packet detail' with an access-list filter names the protocol directly. In Wireshark the Protocol column shows TCP or UDP, and filtering on 'tcp' or 'udp' isolates each. Note that a TCP conversation shows SYN, SYN-ACK and ACK before any payload — if you see data with no handshake, it is UDP.

Does UDP have any error checking at all?

Yes, but only detection, never correction. UDP carries a 16-bit checksum over the header and payload. If the checksum fails, the receiving host discards the datagram silently — there is no notification to the sender and no retransmission, because UDP has no mechanism for either. In IPv4 the checksum is technically optional and a value of zero means unused; in IPv6 it is mandatory. So UDP can tell that something arrived damaged, and its only available response is to throw it away.

TCP and UDP sit at Layer 4, and both are examined in the CCNA 200-301 Network Fundamentals domain. Related reading in the free fundamentals library: the TCP/IP model, the OSI model's seven layers, and how DHCP and DNS actually work.

Studying for the exam? The CCNA syllabus breakdown shows how much each domain is worth, and the free CCNA study guide covers the rest.