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.

UDP Header Transport Layer Packet Analysis Wireshark CCNA

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.

Header size8 bytes, fixed
Header fieldsFour 16-bit fields
IP protocol number17
Delivery modelConnectionless, best effort
UDP header format diagram showing Source Port, Destination Port, Length, Checksum and payload
The UDP packet header is always eight bytes: four fields of 16 bits each, followed by a variable-length payload.

UDP Header Lesson Contents

  1. UDP packet header format
  2. UDP header fields explained
  3. Source and destination ports
  4. Length and payload sizing
  5. UDP checksum explained
  6. Worked DNS packet example
  7. TCP vs UDP header
  8. Advantages, limits and applications
  9. Wireshark analysis
  10. Frequently asked questions

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.

Ethernet frame IPv4 header UDP header UDP payload
Message boundaries are preserved: one UDP send creates one datagram. The receiver reads datagrams as separate messages, unlike TCP's continuous byte stream.

2. UDP Header Fields Explained

UDP has only four header fields. They are shown below in transmission order, with each field explained separately.

Field 1

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.

Field 2

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.

Field 3

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.

Field 4

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.

UDP payload length = UDP Length - 8 bytes

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 protocolCommon UDP portPurpose
DNS53Name queries and many responses
DHCP67 / 68Server and client address configuration
TFTP69Simple file transfer request
NTP123Time synchronization
SNMP161 / 162Queries and notifications
QUIC / HTTP/3Usually 443Secure 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.

IPv4 example: 1,500 MTU - 20-byte IP header - 8-byte UDP header = 1,472-byte UDP payload
Avoid IP fragmentation: tunnels, VPNs, extension headers and lower-MTU links reduce the usable payload. If any fragment is lost, the receiver cannot reconstruct the original datagram. Applications should use a path-safe size instead of assuming 1,472 bytes will always fit.

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.

Integrity is not recovery: the checksum can detect many accidental bit errors, but UDP does not repair a damaged datagram or request retransmission. The receiver normally discards a datagram that fails verification.

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.

UDP packet example showing DNS query header bytes, decoded ports, length, checksum and payload calculation
A complete eight-byte UDP header decoded from a DNS query, with the IPv4 endpoint context shown separately.
CB 95 00 35 00 23 88 03
FieldRaw valueDecoded meaning
Source PortCB 950xCB95 = 52,117, an ephemeral client port.
Destination Port00 350x0035 = 53, the standard DNS service port.
Length00 230x0023 = 35 bytes for header plus data.
Checksum88 03The transmitted checksum is 0x8803.
DNS payload length = UDP Length - UDP header = 35 - 8 = 27 bytes

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.

FeatureUDPTCP
Minimum header8 bytes20 bytes
Communication modelConnectionless datagramsConnection-oriented byte stream
Message boundariesPreservedNot preserved
Delivery and orderingNot guaranteed by UDPReliable, ordered delivery
AcknowledgementsNone in UDPBuilt into TCP
Flow and congestion controlApplication responsibilityBuilt into TCP
Broadcast and multicastSupported by IP where availableNot 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.

ApplicationWhy UDP is usefulImportant qualification
DNSSmall request-response exchangesCan use TCP or other transports when required
DHCPBroadcast discovery before full IP configurationThe protocol adds its own transaction handling
Voice, video and RTPLate data may be less useful than missing dataApplications manage jitter, loss and adaptation
Online gamesFresh position updates can matter more than old onesCritical events may need application acknowledgements
QUIC and HTTP/3UDP offers a portable datagram substrateQUIC adds security, reliability and congestion control
Telemetry and monitoringSimple independent messages with little overheadLoss handling depends on operational requirements
Congestion still matters: connectionless does not mean unlimited sending. A UDP application should control its rate and react to congestion so it does not harm other traffic.

9. How to Analyze a UDP Header in Wireshark

  1. Capture traffic or open a packet capture file.
  2. Use udp to display UDP datagrams, or udp.port == 53 for DNS traffic.
  3. Expand User Datagram Protocol in the packet details pane.
  4. Read the source and destination ports to identify the client and service roles.
  5. Subtract eight from UDP Length to calculate the application payload size.
  6. Compare UDP Length with the IP packet length and any link-layer padding.
  7. Inspect the checksum result, remembering that outbound checksum offload can make a locally captured packet appear unverified or incorrect.
  8. Examine the application decoder, such as DNS or DHCP, after confirming the UDP fields.
Useful filters: udp | udp.port == 53 | udp.srcport == 68 && udp.dstport == 67 | udp.length > 1400 | ip.proto == 17

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

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.