Network security

What Is UDP? User Datagram Protocol Explained Simply (vs TCP)

UDP trades reliability for speed: no handshake, no retransmission, just small independent datagrams. Here is how it works, where it is used, and where it goes wrong.

Cysoro Security TeamPublished · 6 min read
8-byte header • no handshake NETWORK SECURITY What isUDP? Fast, connectionless, best-effort.
Quick answer

UDP, the User Datagram Protocol, is a connectionless transport-layer protocol defined in RFC 768 that sends independent messages called datagrams without a handshake, acknowledgments, retransmission or ordering. Its 8-byte header keeps overhead low, so it suits DNS, DHCP, video calls, gaming and QUIC, where speed matters more than guaranteed delivery.

Key takeaways

  • UDP sends independent datagrams with no connection, handshake or retransmission — delivery is best-effort.
  • Its header is only 8 bytes: source port, destination port, length and checksum.
  • UDP powers DNS, DHCP, NTP, voice and video calls, gaming and QUIC (HTTP/3), but it is also abused for spoofing and amplification attacks.

Every DNS lookup, every video-call frame and every online game move has to cross the internet somehow. Much of that traffic does not use TCP at all. It uses UDP — a protocol so simple its entire specification fits in about three pages.

What is UDP?

UDP, the User Datagram Protocol, is a connectionless transport-layer protocol that sends independent messages called datagrams between applications without first establishing a connection. It is defined in RFC 768, as BlueCat explains.

UDP adds only two things to IP: port numbers, so many applications on one host can share the network, and a checksum, so the receiver can detect corrupted data. Everything else — reliability, ordering, retransmission — is left to the application.

Think of TCP as a phone call: you dial, wait for an answer, talk, and hang up properly. UDP is a postcard: you write the address, drop it in the postbox and walk away. You never know for certain whether it arrived.

How does UDP work?

UDP works by wrapping application data in a small datagram and handing it to IP. There is no connection setup, no acknowledgment and no retransmission at the transport layer, so each datagram travels independently.

How UDP sends a datagram1App builds a messagea DNS question, a gameupdate, a voice frame2UDP adds 8-byte headerports, length,checksum — then IP3Receiver checks itwrong checksum: drop itlost datagram: no resendNo handshake, no connection state, no second chance at this layer.
UDP in three steps: build, wrap, send — and hope. Illustration by Cysoro.

The steps are simple. First, the application builds a complete message that fits in one datagram. Second, UDP prepends its 8-byte header. Third, IP routes the datagram to the destination, where the receiving application reads it as a whole message.

Because one send is one datagram, UDP preserves message boundaries: the receiver gets the whole datagram or nothing. TCP, by contrast, delivers a continuous byte stream with no message boundaries at all.

The entire UDP header is just 8 bytes, made of four 16-bit fields. That is the whole protocol overhead, compared with a TCP header of at least 20 bytes.

FieldSizeWhat it does
Source port2 bytesWhich program sent it, so a reply can find its way back
Destination port2 bytesWhich program should receive it
Length2 bytesSize of the header plus the data
Checksum2 bytesLets the receiver detect corrupted data

That is all. No handshake, no sequence numbers, no acknowledgments, no resends and no window for flow control. UDP runs directly on top of IP as protocol number 17.

The checksum lets the receiver detect corruption, but UDP does nothing about it beyond dropping the damaged datagram. If the data matters, the application must ask for it again.

UDP vs TCP: what is the difference?

UDP and TCP are the two classic transport protocols, and they make opposite trade-offs. TCP prioritizes reliable, ordered delivery; UDP prioritizes simplicity and low latency.

PropertyUDPTCP
ConnectionConnectionless, no handshakeConnection-oriented, three-way handshake
ReliabilityBest-effort; loss is possibleAcknowledged and retransmitted
OrderingNot preservedPreserved, in order
Header size8 bytesAt least 20 bytes
Data unitDatagram, boundaries keptByte stream, no boundaries
Broadcast / multicastYesNo
Congestion controlNone built inBuilt in

TCP establishes a connection with a SYN, SYN-ACK and ACK handshake, numbers every byte, resends whatever gets lost and hands the data over in order. UDP skips all of that, which reduces overhead and can minimize delays, as Decodo's TCP vs UDP guide explains.

The choice is usually a latency-versus-guarantee decision. If late data is worse than missing data — a voice frame, a game position, a live video frame — UDP wins. If every byte must arrive, use TCP, or use a protocol built on UDP that adds reliability itself.

What is UDP used for?

UDP is the default transport for DNS because a typical lookup is one small question and one small answer. A TCP handshake for every lookup would add delay and per-connection state across high-volume resolvers.

  • DNS (port 53): most queries and responses; TCP is used for zone transfers and large or truncated responses.
  • DHCP (ports 67 and 68): assigning IP addresses before a device has one — a connection would be impossible.
  • NTP (port 123): time synchronization, where small, frequent messages matter.
  • Voice and video calls: a lost frame is better than a delayed one, so calls use UDP and conceal the gap.
  • Online gaming: position updates arrive constantly, so a stale update is useless anyway.
  • Live streaming: viewers would rather miss a frame than wait for it.
  • QUIC and HTTP/3: QUIC builds its own reliability, encryption and congestion control on top of UDP.
  • SNMP and syslog: simple monitoring messages where occasional loss is acceptable.

UDP also supports broadcast and multicast, which TCP cannot do. That makes it useful for service discovery on a local network, where one message must reach many devices at once.

You can see DNS in action yourself: run a lookup with our free DNS lookup tool.

While you are there, check what your IP address is to see the address your DNS queries come from.

What happens when a UDP datagram is lost?

When a UDP datagram is lost, nothing happens at the transport layer. UDP does not notice, does not resend and does not tell the sender. The application must handle it — or decide it does not matter.

That is a feature, not just a flaw. A video call that waited for every lost frame would freeze constantly. Instead, the call drops the frame and moves on, and you rarely notice. A DNS resolver, by contrast, simply retries the query after a short timeout if no answer arrives.

Datagrams can also arrive duplicated or out of order, and the network may deliver them in any sequence. Applications that care about order must number their own messages and reorder them, which is exactly what QUIC does on top of UDP.

Is UDP secure? How attackers abuse it

UDP itself has no encryption or authentication, so it is not secure on its own. Because the source address is not checked before a reply is sent, UDP is used in spoofing and amplification attacks.

In a UDP amplification attack, the attacker sends small requests with a forged victim address to a server that replies with a much larger response. The victim, not the attacker, receives the flood. DNS and NTP servers have both been abused this way, which is why open resolvers are a security problem.

UDP flood attacks work the same way in reverse: a target is overwhelmed with datagrams that its systems must inspect and discard. Firewalls and rate limiting help, but the real fix is to stop spoofed traffic at its source and to close open UDP services.

Secure use of UDP means adding protection above it. QUIC encrypts its traffic, DTLS adds TLS-style security to datagrams, and VPNs can tunnel UDP inside an encrypted channel. If you use WebRTC video calls, our WebRTC leak test shows what your browser may be revealing.

Do not expose UDP services to the internetAn open DNS resolver or NTP server can be turned into an amplifier for attacks on someone else. Only expose UDP services you need, and restrict who can reach them.

When should you use UDP instead of TCP?

Use UDP when speed and simplicity matter more than guaranteed delivery, when messages are small and self-contained, or when you need broadcast or multicast. Use TCP when every byte must arrive in order.

UDP or TCP? A quick decision guideChoose UDP when…• A lost packet is better than a late one• Messages are small and independent• You need broadcast or multicast• You will add reliability yourself (QUIC)Choose TCP when…• Every byte must arrive, in order• You are sending files or web pages• You want built-in congestion control• You do not want to build reliability
Pick UDP for real-time traffic, TCP when completeness matters. Illustration by Cysoro.

Most modern applications do not choose raw UDP or raw TCP directly. They use a higher-level protocol: HTTP/3 runs on QUIC over UDP, video calls use RTP over UDP, and email and file transfers use TCP. The transport choice is made for you by the protocol designer.

If you are building an application yourself, the rule is simple: if you can tolerate loss and need low latency, start with UDP and add only the reliability you need. If you cannot tolerate loss, start with TCP.

The bottom line

UDP is the internet's lightweight courier: an 8-byte header, no handshake, no promises. That simplicity makes DNS fast, calls responsive and games playable — and it is why QUIC chose UDP as its foundation.

Its weakness is also its simplicity: lost, duplicated or out-of-order datagrams are your application's problem, and unprotected UDP services can be abused. Use UDP where speed matters, add security above it, and let TCP handle the work where every byte counts. Check your own connection with our free IP lookup tool.

Frequently asked questions

What does UDP stand for?

UDP stands for User Datagram Protocol. It is a transport-layer protocol that sends data as independent messages called datagrams, without first establishing a connection between sender and receiver.

Is UDP faster than TCP?

UDP has lower overhead because it skips the handshake, acknowledgments and retransmission that TCP performs. That can mean lower latency, but it is not automatically faster for every workload, because the application must handle any lost or out-of-order data itself.

What is UDP used for?

UDP is used for DNS lookups, DHCP address assignment, NTP time sync, voice and video calls, online gaming, live streaming and QUIC, the transport behind HTTP/3. All of these value low latency or simple request-reply exchanges over guaranteed delivery.

Is UDP reliable?

No, not by itself. UDP provides best-effort delivery: datagrams can be lost, duplicated or arrive out of order, and UDP will not notice or resend them. Reliability, if needed, must be built by the application or a higher-level protocol such as QUIC.

What port does UDP use?

UDP does not have a single port. It uses port numbers to direct datagrams to applications, just like TCP. Well-known examples are DNS on port 53, DHCP on ports 67 and 68, and NTP on port 123.

Is UDP secure?

UDP itself has no encryption or authentication, so it is not secure on its own. Because the source address is not verified, UDP is abused for spoofing and amplification attacks. Secure applications add encryption and authentication above UDP, for example with DTLS or QUIC.

Does UDP use a handshake?

No. UDP is connectionless and sends datagrams directly to the destination with no handshake, no connection state and no teardown. That is why a DNS resolver can answer many clients without keeping a connection open for each one.

Sources

  1. BlueCat — What is UDP? User Datagram Protocol explained
  2. Decodo — TCP vs. UDP: Key Differences Explained
  3. Software Engineering Unpacked — TCP vs UDP: The Difference Explained Simply
  4. Localtonet — TCP vs UDP: The Complete Guide to Network Protocols
  5. Rawvj — What Is UDP? UDP vs TCP, Header and Uses Explained
Written & fact-checked byCysoro Security Team

The engineers and analysts who build Cysoro's domain scanner, email-authentication checks and free security tools. We test what we write about every day — SPF, DKIM, DMARC, certificates, look-alike domains and phishing — and check each guide against the relevant standards, government guidance and vendor documentation.

  • Email authentication
  • Phishing & BEC
  • Domain & DNS security
  • Small-business security

Checked against RFC 768 as described by BlueCat, MDN-cited summaries and TCP/UDP comparison guides.

How we write and fact-check →

Free tools for this topic

No account needed.

See where your domain stands

Free for up to 3 domains. No card, no installs.

Start free