Interview Q&A / Computer Networks

BeginnerQuick answer1 min readUpdated 3 Oct 2026

What does a UDP header contain, and how big is it?

SHORT ANSWER

A UDP header is 8 bytes with four 16-bit fields: source port, destination port, length, and checksum. A TCP header is at least 20 bytes. That small size is part of why UDP is light.

Explain it simply

A UDP datagram is a postcard: sender's room, receiver's room, how long the message is, and a check number to detect damage. TCP is a registered courier envelope with tracking and acknowledgement fields on top.

Example

text
 0        16        32 bits
+---------+---------+
| src port| dst port|
+---------+---------+
| length  | checksum|
+---------+---------+
| data ...
  • Source port: optional in UDP; can be 0 if no reply is expected.
  • Length: header plus data in bytes, so the minimum is 8.
  • Checksum: detects corruption; optional in IPv4, required in IPv6.

If the checksum fails, the receiver drops the datagram silently. There is no retransmission, no sequence number and no connection state. A datagram with 100 bytes of data has length 108.

What to say in the interview

"UDP has just four fields in 8 bytes: source port, destination port, length and checksum. There are no sequence numbers, acknowledgements or flow control, so reliability, if any, is the application's job."

Common mistakes

  • Saying UDP has no checksum. It has one; it just does not retransmit on failure.

#udp#header#transport

Related questions

Practise more Computer Networks questions

Test your recall with short answers, then return to the detailed explanations when you need context.

Open Computer Networks quick answers →

Get new questions like this by email

One short email when something new and useful lands. No spam, unsubscribe in one tap.

By subscribing you agree to the Privacy Policy.