UDP Header Explained: Format, Fields, Packet Structure & Examples
Learn the User Datagram Protocol header in clear, practical language. This guide explains its four fields, fixed eight-byte format, checksum, port numbers, payload sizing, applications and a decoded DNS packet example.
What Is UDP?
User Datagram Protocol (UDP) is a transport layer protocol for sending independent messages called datagrams. It is connectionless: an application can send data without first establishing a session or negotiating a transport connection.
UDP provides port-based application delivery and an integrity check, but it does not guarantee arrival, remove duplicates, restore packet order or retransmit lost data. That small design is useful when low overhead, timely delivery or application-controlled reliability matters more than TCP-style delivery guarantees.
UDP Header Lesson Contents
1. UDP Packet Header Format and Structure
A UDP datagram contains an eight-byte header followed by application data. The header is arranged as two 32-bit rows and transmitted in network byte order. Unlike TCP or IPv4, UDP has no variable-length options, so the application payload always begins after byte 8.
2. UDP Header Fields Explained
UDP has only four header fields. They are shown below in transmission order, with each field explained separately.
Source Port - 16 bits
Purpose: identifies the sending application and gives the receiver a port to use when replying.
Example: a DNS client might use temporary source port 52,117 while sending to destination port 53.
Special case: RFC 768 permits source port zero when the sender does not need to identify a reply port. Most normal request-response traffic uses a real source port.
Destination Port - 16 bits
Purpose: identifies the receiving application or service. The destination host uses this value to deliver the datagram to the correct socket.
Example: port 53 commonly identifies DNS, port 123 identifies NTP, and ports 67 and 68 are used by DHCP server and client roles.
Length - 16 bits
Purpose: records the complete UDP datagram size in bytes, including both the eight-byte header and application payload.
How to read it: the minimum valid value is 8, which means header only. A Length value of 35 means 35 - 8 = 27 bytes of UDP payload.
Checksum - 16 bits
Purpose: detects accidental corruption and helps detect delivery using incorrect IP endpoint information.
Coverage: the calculation includes an IP pseudo-header, the UDP header and all UDP data. The pseudo-header contributes IP addresses, protocol information and UDP length but is not transmitted inside the UDP header.
Protocol rule: the checksum may be omitted in IPv4 by transmitting 0x0000; it is normally mandatory with IPv6.
3. Source and Destination Port Numbers
Port numbers provide transport-layer multiplexing and demultiplexing. A client normally chooses a temporary source port, while the destination port identifies the requested service. The operating system combines IP addresses, port numbers and protocol to direct each datagram to the correct application.
Well-known ports
Frequently used services have standardized assignments, such as DNS port 53 and NTP port 123.
Ephemeral ports
Client software usually receives a temporary source port from the operating system. The exact allocation range is platform-dependent.
Source port zero
UDP allows a zero source port in IPv4 when a response is not expected. Most normal client-server exchanges use a real source port.
Socket delivery
A destination port alone does not identify a remote endpoint. Hosts also use the IP protocol and local or remote addresses when matching sockets.
| Application or protocol | Common UDP port | Purpose |
|---|---|---|
| DNS | 53 | Name queries and many responses |
| DHCP | 67 / 68 | Server and client address configuration |
| TFTP | 69 | Simple file transfer request |
| NTP | 123 | Time synchronization |
| SNMP | 161 / 162 | Queries and notifications |
| QUIC / HTTP/3 | Usually 443 | Secure web transport built above UDP |
Port assignments should be checked in the IANA Service Name and Port Number Registry.
4. UDP Length, Header Size and Payload Limits
The 16-bit Length field counts the UDP header and data together. A value of 8 represents an empty UDP payload. For ordinary IPv4, the theoretical maximum UDP payload is 65,507 bytes after subtracting the minimum 20-byte IPv4 header and eight-byte UDP header from the 65,535-byte IPv4 packet limit.
Minimum UDP length
8 bytes: header only, with no application data.
IPv4 maximum payload
65,507 bytes with a minimum IPv4 header and no additional encapsulation.
IPv6 maximum payload
65,527 bytes for a normal non-jumbogram packet with a 40-byte IPv6 header.
Ethernet MTU example
A 1,500-byte MTU leaves 1,472 bytes for UDP data over basic IPv4, or 1,452 bytes over basic IPv6.
5. UDP Checksum Explained
The UDP checksum uses one's-complement arithmetic. The sender calculates it across an IP pseudo-header, the UDP header and the payload. The pseudo-header is not transmitted as part of UDP; it contributes source and destination addresses, protocol information and UDP length so misdelivery can be detected.
Checksum coverage
IP pseudo-header + UDP header + application data. An odd number of data bytes is padded with one zero byte for calculation only.
IPv4 rule
The checksum may be omitted. A transmitted value of 0x0000 means the sender did not generate one.
IPv6 rule
The checksum is normally mandatory. IPv6 removed the IP header checksum, making transport integrity especially important.
Calculated zero
If the checksum calculation produces zero, UDP transmits 0xFFFF. This keeps 0x0000 available to mean omitted in IPv4.
6. UDP Packet Example: Decoding a DNS Query
The following eight bytes are a complete UDP header from a DNS query. Read each pair of 16-bit values in network byte order. The surrounding IPv4 packet travels from 10.82.100.134 to 10.82.100.253, but those addresses belong to the IP header, not the UDP header.
| Field | Raw value | Decoded meaning |
|---|---|---|
| Source Port | CB 95 | 0xCB95 = 52,117, an ephemeral client port. |
| Destination Port | 00 35 | 0x0035 = 53, the standard DNS service port. |
| Length | 00 23 | 0x0023 = 35 bytes for header plus data. |
| Checksum | 88 03 | The transmitted checksum is 0x8803. |
A second common example is DHCP: a client can send from UDP port 68 to server port 67 before it owns an address, using IPv4 source 0.0.0.0 and broadcast destination 255.255.255.255.
7. TCP vs UDP Header
UDP and TCP both use port numbers at the transport layer, but their service models are different. UDP is not automatically faster in every application; it simply exposes less transport machinery and leaves more decisions to the application.
| Feature | UDP | TCP |
|---|---|---|
| Minimum header | 8 bytes | 20 bytes |
| Communication model | Connectionless datagrams | Connection-oriented byte stream |
| Message boundaries | Preserved | Not preserved |
| Delivery and ordering | Not guaranteed by UDP | Reliable, ordered delivery |
| Acknowledgements | None in UDP | Built into TCP |
| Flow and congestion control | Application responsibility | Built into TCP |
| Broadcast and multicast | Supported by IP where available | Not supported |
8. UDP Advantages, Disadvantages and Applications
UDP is a strong fit when an application benefits from low transport overhead, independent messages, multicast or direct control over retransmission and timing. The trade-off is that the application must tolerate or manage loss, reordering, duplication and congestion.
| Application | Why UDP is useful | Important qualification |
|---|---|---|
| DNS | Small request-response exchanges | Can use TCP or other transports when required |
| DHCP | Broadcast discovery before full IP configuration | The protocol adds its own transaction handling |
| Voice, video and RTP | Late data may be less useful than missing data | Applications manage jitter, loss and adaptation |
| Online games | Fresh position updates can matter more than old ones | Critical events may need application acknowledgements |
| QUIC and HTTP/3 | UDP offers a portable datagram substrate | QUIC adds security, reliability and congestion control |
| Telemetry and monitoring | Simple independent messages with little overhead | Loss handling depends on operational requirements |
9. How to Analyze a UDP Header in Wireshark
- Capture traffic or open a packet capture file.
- Use
udpto display UDP datagrams, orudp.port == 53for DNS traffic. - Expand User Datagram Protocol in the packet details pane.
- Read the source and destination ports to identify the client and service roles.
- Subtract eight from UDP Length to calculate the application payload size.
- Compare UDP Length with the IP packet length and any link-layer padding.
- Inspect the checksum result, remembering that outbound checksum offload can make a locally captured packet appear unverified or incorrect.
- Examine the application decoder, such as DNS or DHCP, after confirming the UDP fields.
UDP Header CCNA and Interview Notes
- Header size: always eight bytes, with no options.
- Four fields: Source Port, Destination Port, Length and Checksum.
- Length: includes both the UDP header and its payload.
- Protocol number: IP identifies UDP with decimal 17.
- Checksum: covers a pseudo-header, UDP header and data; it is normally mandatory with IPv6.
- Delivery: UDP does not provide acknowledgements, sequencing or retransmission.
- Application design: reliability and congestion control can be implemented above UDP when needed.
Continue with the IPv4 header format, DHCP operation, DNS practice and the port checker.
UDP Header Frequently Asked Questions
What is a UDP header?
It is the fixed eight-byte control section before a UDP payload. It carries source and destination ports, total UDP length and a checksum.
What are the UDP header fields?
Source Port, Destination Port, Length and Checksum. Every field is 16 bits, so all four together occupy eight bytes.
Why is the UDP header only 8 bytes?
UDP stores only essential port, size and integrity information. It has no sequence, acknowledgement, window, flag or option fields.
What does the UDP checksum protect?
It covers an IP pseudo-header, the UDP header and the payload. This detects accidental corruption and helps detect delivery using incorrect IP endpoint information.
What does the UDP Length field include?
It includes the eight-byte header and all UDP application data. Subtract eight from the field to obtain payload length.
Does UDP use acknowledgements?
No. UDP itself does not acknowledge delivery, retransmit losses or restore order. An application protocol may add those features.
How is UDP different from TCP?
UDP sends independent datagrams with an eight-byte header. TCP establishes a connection and provides ordered delivery, acknowledgements, retransmission, flow control and congestion control with a header of at least 20 bytes.
UDP Standards and Additional Resources
- RFC 768 - User Datagram Protocol
- RFC 8085 - UDP Usage Guidelines
- RFC 6335 - Service Name and Port Number Procedures
- RFC 8200 - Internet Protocol, Version 6
- IANA Service Name and Port Number Registry
This lesson was independently rewritten and expanded from the supplied UDP packet-header notes. Field definitions, checksum behavior, sizing examples and diagrams were checked against the UDP specification and current usage guidance.