Quiz Entry - updated: 2026.07.14
What are the fields in a UDP header?
The UDP header is a fixed 8 bytes with only four 16-bit fields: source port, destination port, length, and checksum.
* Four 16-bit fields, 8 bytes total, then the payload. *
UDP Header Structure (8 bytes total):
┌─────────────────┬─────────────────┐
│ Source Port │ Destination Port│
│ (16 bits) │ (16 bits) │
├─────────────────┼─────────────────┤
│ Length │ Checksum │
│ (16 bits) │ (16 bits) │
└─────────────────┴─────────────────┘
| Field | Size | Purpose |
|---|---|---|
| Source Port | 16 bits | Identifies sending application |
| Destination Port | 16 bits | Identifies receiving application |
| Length | 16 bits | Length of UDP datagram (header + data) |
| Checksum | 16 bits | Error checking of header and data |
Comparison:
- UDP header: 8 bytes
- TCP header: 20+ bytes
Key insight: UDP's simpler header means less overhead, making it faster but less reliable than TCP.
Memory tip: UDP (User Datagram Protocol) has a fixed 8-byte header - tiny compared to TCP's 20+ bytes, which is why it is fast and low-overhead.
Go deeper:
RFC 768 — Format — the spec literally lists these four fields and nothing more.
UDP datagram structure — Wikipedia's header diagram for the carousel.