Use it to read a TCP capture: what was sent, what was acknowledged, what is being resent, and whether the receiver is holding the sender back.
TCP Header Field Reference
Every TCP segment starts with a header of at least 20 bytes: source and destination port, sequence number, acknowledgment number, flags, receive window, checksum and options.
1. Isolate one connection (both addresses and ports).
2. Read SYN and SYN-ACK: options, window scale.
3. Follow sequence numbers one way and acknowledgments the other.
4. Same sequence range twice → retransmission.
5. Acknowledgment stuck while data arrives → a gap. Window near zero → the receiver is slow.
ports identify the connection → sequence numbers advance by the bytes sent → acknowledgment numbers follow → window stays above zero → no sequence range repeated
Context & applicabilityCommon mistakes · platform/version boundaries
Operational reference
Fast context before you go deeper.
tcpdump -ni eth0 -S host 192.0.2.10 and tcp port 443Verification & Troubleshooting
Start with the observed symptom, prove the nearest boundary, and move outward only when the current state is understood.
Use the operational verification above to establish the expected state.
Capture the concrete output, symptom, packet, log or counter before changing anything.
Step 1 Operational verification Verify boundary
tcpdump -ni eth0 -S host 192.0.2.10 and tcp port 443
ss -ti dst 192.0.2.10
tcpdump prints, per segment, the flags, the sequence range (seq 1000:1500), the acknowledgment number, the window and the options; -S shows absolute numbers. ss -ti on Linux shows what the kernel knows about a live connection: round-trip time, congestion window, retransmissions.
In Wireshark, follow one connection (tcp.stream eq N) and read sequence, next sequence and acknowledgment columns side by side for both directions. The first two packets, SYN and SYN-ACK, contain the options — including the window scale — that apply to the rest.
Known-good: sequence numbers advance without gaps, acknowledgments follow them, and the window stays comfortably above zero.
Step 2 Failure isolation workflow Narrow the fault
- The same sequence range appears twice. A retransmission: the original, or its acknowledgment, was lost — or the capture point sees a duplicate.
- The acknowledgment number stops advancing while data keeps arriving. A gap: one segment is missing and the receiver repeats the same acknowledgment.
- The window shrinks towards zero. The receiving application is not reading; the sender has to pause.
- Window values look tiny. The capture does not include the handshake, so the scaling factor is unknown.
- Segments appear larger than the MTU in a capture on the sender. The network card splits them after the capture point (segmentation offload).
- Sequence numbers jump unexpectedly between two capture points. A firewall or load balancer rewrites them, or terminates the connection and opens its own.
- Checksum errors on outgoing packets in a local capture. The card computes the checksum after capture; not a real error.
Evidence · 1 on this Topic
Expected observations and documentation recipes are reference material. Record actual output, device identity, scope and time before claiming a verified result.
Sequence numbers count bytes, not packets. The acknowledgment number is the next byte expected — everything before it has arrived. Each direction has its own numbering. The window field must be multiplied by the scale agreed in the handshake.
tcpdump -ni <if> -S host <ip> and tcp port <port>— flags, sequence range, acknowledgment, window, options per segment.ss -ti dst <ip>— the kernel's view of a live connection: round-trip time, window, retransmissions.- Wireshark:
tcp.stream eq N, then the sequence, next-sequence and acknowledgment columns.
ReferenceWhat it is1 section · depth on demand
Mechanics & mental model
Every TCP segment begins with a header of at least 20 bytes. It names the two ports, carries the numbers that make delivery reliable — sequence and acknowledgment — and holds the flags, the receive window and any options.
ReferenceWhy it matters1 section · depth on demand
Why it matters operationally
Reading a TCP capture is reading these fields. The sequence and acknowledgment numbers show what was sent, what arrived and what is being resent; the window shows whether the receiver is holding the sender back; the flags show how the connection opens and ends.
ReferenceHow it works1 section · depth on demand
How it works
| Field | Size | Meaning |
|---|---|---|
| Source port | 16 bits | The sender's port |
| Destination port | 16 bits | The receiver's port |
| Sequence number | 32 bits | The position, in the sender's byte stream, of the first data byte in this segment |
| Acknowledgment number | 32 bits | The next byte the sender of this segment expects to receive — everything before it has arrived |
| Data offset | 4 bits | Length of the header in 32-bit words; 5 without options |
| Flags | 8 bits | SYN, ACK, FIN, RST, PSH, URG and two congestion bits |
| Window | 16 bits | How many more bytes the sender of this segment can accept |
| Checksum | 16 bits | Covers header, data and the IP addresses |
| Urgent pointer | 16 bits | Rarely used |
| Options | 0–40 bytes | Maximum segment size, window scaling, selective acknowledgment, timestamps |
Sequence numbers count bytes, not packets. A segment with sequence number 1000 and 500 bytes of data covers bytes 1000 to 1499; the next segment starts at 1500. The SYN and the FIN each use up one sequence number although they carry no data.
The acknowledgment number is cumulative. "ACK 1500" means "I have everything up to 1499; send 1500 next". If the segment starting at 1500 is lost but later ones arrive, the receiver keeps answering "ACK 1500" — these repeated acknowledgments are how the sender recognises the gap.
Each direction has its own numbering. The client's sequence numbers are acknowledged by the server's acknowledgment numbers, and the reverse. Both start from a random initial value chosen at the handshake.
Relative numbers. Wireshark displays sequence numbers starting from 0 for readability. The real 32-bit values are in the packet; switch the display if a capture must be compared with a firewall log.
The window is the receiver's free buffer space. With the window scaling option, the value in the field is multiplied by a factor agreed in the handshake, so the field alone does not give the true size.
ReferenceImportant terms & boundaries1 section · depth on demand
In depth
The TCP header field by field
RFC 9293 defines a fixed 20-byte header, followed by options. The Data Offset field gives the header length in 32-bit words, so options can extend the header up to 60 bytes. In order, the fields are source port, destination port (16 bits each), sequence number and acknowledgement number (32 bits each), data offset (4 bits), reserved bits, eight control bits (CWR, ECE, URG, ACK, PSH, RST, SYN, FIN), window (16 bits), checksum (16 bits) and urgent pointer (16 bits).
Fields and what they tell you
| Field | Size | Operational use |
|---|---|---|
| Source / destination port | 16 + 16 | Identify the application and the connection |
| Sequence number | 32 | Position of the first data byte; spot gaps and retransmissions |
| Acknowledgement number | 32 | Next byte expected; spot loss (duplicate ACKs) |
| Data offset | 4 | Header length: 5 means 20 bytes, no options |
| Flags | 8 | Segment purpose: open, data, close, reset, ECN |
| Window | 16 | Receive window, scaled if window scaling was negotiated |
| Checksum | 16 | Mandatory; covers a pseudo-header, the header and the data |
| Urgent pointer | 16 | Rarely used today |
| Options | 0–40 bytes | MSS, window scale, SACK, timestamps |
Header length in captures
| Data offset | Header length | Typical segment |
|---|---|---|
| 5 | 20 bytes | No options (rare on modern stacks) |
| 8 | 32 bytes | Data segment with timestamps (12 bytes of options) |
| 10 | 40 bytes | SYN with MSS, SACK-permitted, timestamps and window scale |
host$ sudo tcpdump -ni eth0 -S -c 3 'host 10.30.0.15 and tcp port 443'
10:41:02.100 IP 10.110.0.64.50414 > 10.30.0.15.443: Flags [S], seq 1830472001, win 64240, options [mss 1460,sackOK,TS val 1 ecr 0,nop,wscale 7], length 0
10:41:02.101 IP 10.30.0.15.443 > 10.110.0.64.50414: Flags [S.], seq 409117, ack 1830472002, win 65160, options [mss 1460,sackOK,TS val 9 ecr 1,nop,wscale 7], length 0
10:41:02.101 IP 10.110.0.64.50414 > 10.30.0.15.443: Flags [.], ack 409118, win 502, options [nop,nop,TS val 2 ecr 9], length 0
host$ tshark -r capture.pcap -Y tcp -T fields -e tcp.hdr_len -e tcp.flags.str -e tcp.window_size_value -e tcp.window_size | head -3
-S prints absolute sequence numbers. Without it, tcpdump shows relative numbers after the first segment. In the third line, win 502 is the raw value; with window scale 7 the real window is 502 × 128 = 64,256 bytes. Wireshark shows both values (window_size_value and window_size).
Documented example, not captured output.
Additional reference context Scope · expected state · examples · history · terminology Open only when you need the supporting context
Verification history & basis
When and against what this Topic was checked. Later text edits do not count as a new check.
Authoritative/upstream documentation reviewed for bounded claims in Network & Protocols → TCP Header Field Reference. Documentation verification only; this is not observed lab or production Evidence.
Basis: https://www.rfc-editor.org/rfc/rfc9293.html · confidence 94%What changed and what may be affected
Recent technical edits are separated from ordinary page timestamps. Relationship impact is advisory: it identifies nearby canonical references to review, not automatic breakage.
Terms & aliases
Hover a linked term for a quick definition; click it to open its glossary entry. Aliases are other names that find this Topic in search.
Operational notes
Former standalone Cheat Sheet content now lives directly inside the Topic where it belongs.
TCP Header Fields
Seq/Ack/window/flags/options.
30-second lookup
- Open Packet Field Explorer for field-level metadata.
- Use Packet Decoders for bit/flag values where relevant.
- Use Paste Output / Structured Parser for CLI evidence.
- Use Packet Filters to prove the wire boundary.
Evidence rule
A decoded field proves what is present in that packet/output at that moment. Continue through the verification chain before concluding end-to-end behavior.