What is the actual max packet size for a TCP connection?

Jotted down on 04 April 2022

180 words

By default, the max limit of a TCP packet is 64K or 65535 bytes.

1GB if you use window scaling (by left shifting the window size by 14).

Unfortunately, we cannot use such large MTUs.

The MTU of the lowest layer i.e., the Network Layer is what matters. Data travels from the highest to the lowest layer during transmission. Thus, having a higher MTU on the upper layers does not matter.

Generally, the MTU of the Ethernet Layer is 1500 bytes.

Your TCP packet will go through fragmentation if the size exceeds 1500 bytes. As it brings the overhead of rebuilding the original packet at the receiving end.

Checking further, you would find there are TCP and IP headers that occupy 40 bytes (20 + 20) with no options. Best case scenario. They occupy 40 bytes. Worst case, 60 + 24 bytes.

This gives the max TCP packet size to be 1460 bytes. No fragmentation required.

TCP packet fragmentation due to bandwidth constraints in Ethernet Layer
 
No spam. Unsubscribe at any time.