What is UDP?
Author: Domeny.ForSale editorial team Published
In brief: UDP is a network protocol that transmits small chunks of data without first establishing a connection. It does not itself acknowledge receipt, retransmit lost packets or ensure the correct delivery order. It is useful where up-to-date data and low latency matter more than recovering every missing chunk—for example, in voice calls and online games.
How does UDP work, and what is a datagram?
UDP, or User Datagram Protocol, is a transport-layer protocol: it defines how data is passed between applications over a network. It runs on top of IP, the protocol responsible for addressing and transmitting packets between devices. IP helps reach the correct host, while UDP uses port numbers to direct data to the appropriate service or application.
A single UDP message is a datagram. It contains application data and a header with information such as the source port, destination port and message length. The UDP header is 8 bytes long; transmission over a network also requires headers from other layers, including IP.
The sender transmits a datagram to a chosen IP address and port number. UDP does not first establish a connection with the recipient through a process known as a handshake. This does not mean, however, that an application using UDP cannot have a login process, sessions or its own communication handshake.
UDP preserves message boundaries: two transmitted datagrams do not become a single byte stream. However, the recipient may receive them in reverse order, receive a duplicate or receive neither of them.
What does UDP not guarantee?
An application successfully sending a datagram is not proof that the recipient received it. A packet may be lost because of network congestion, a firewall or the absence of a program listening on the specified port, among other reasons. UDP itself does not remedy this situation.
The protocol also provides neither flow control, which adjusts the sending rate to the recipient’s capacity, nor network congestion control. If an application needs these features, it must use additional mechanisms. Sending ever more data without responding to losses can make communication worse rather than faster.
UDP does not encrypt data or verify the sender’s identity. Confidentiality and authentication can be provided by protocols running on top of it, such as DTLS or QUIC. The absence of these features in UDP itself therefore does not mean that every service using it transmits information without protection.
UDP vs TCP: when does the difference matter?
TCP, or Transmission Control Protocol, is another widely used transport protocol. It establishes a connection and provides the application with an ordered byte stream, automatically retransmitting lost data. If communication cannot continue, it may end in an error—TCP does not guarantee the success of an entire business operation either, such as saving an order.
| Feature | UDP | TCP |
|---|---|---|
| Connection establishment | None in the protocol itself | Required |
| Data transfer method | Separate datagrams | Byte stream |
| Retransmission of lost data | No automatic retransmission | Built in |
| Data order | Not guaranteed | Preserved in the stream |
| Congestion control | None in UDP itself | Built in |
The statement “UDP is faster than TCP” is an oversimplification. UDP has a smaller header and does not wait for acknowledgements, but actual latency also depends on the network and application design. When a program must acknowledge receipt and retransmit every message itself, some of that advantage may disappear.
Imagine a game in which the client regularly receives an opponent’s position. If one update is lost, a newer one may be more useful than retransmitting the old one. By contrast, information about an item purchase requires confirmation and protection against the transaction being executed twice—UDP alone cannot provide that.
Where will you encounter UDP in practice?
UDP is used in many services, although the details depend on the particular program and network conditions:
- Voice calls and video conferences: a late audio sample may be less useful than a brief gap masked by the application.
- Online games: frequent state updates can be transmitted without waiting for earlier data to be recovered.
- DNS, the Domain Name System: many queries and responses use UDP, but DNS also uses TCP, and its encrypted variants use additional protocols.
- HTTP/3: uses QUIC, which runs on UDP and adds features including encryption, reliable stream transport and congestion control.
HTTP/3 shows that “runs on UDP” does not mean “can lose page content without consequences”. Guarantees absent from UDP can be provided by the layer above it.
How can you check whether an application needs UDP?
If you are configuring a router or firewall, check the application’s documentation for the required protocol, port and traffic direction. A TCP port and a UDP port with the same number are separate communication endpoints: allowing TCP will not automatically unblock UDP.
Do not open both protocols “just in case”. A normal outgoing connection usually does not require manual port forwarding, whereas hosting a server on a home network may require it. Start by determining whether the program only connects to a service or needs to accept traffic from the internet—the correct configuration depends on this.
See also: What is GitLab?
