Toolvito

Works on this device

Tcp Window Size Calculator

Work out how large the TCP receive window must be to use a whole link, from the rate of the link and the round-trip time. The page also shows the largest rate that a window allows, and the shift count of the window scale option for a window above 65,535 bytes. Nothing is measured here: you type the figures.

Enter your values

The receive window that lets one TCP connection use the whole link.

Your values

The rate of the slowest link on the path. Mbit/s is megabits per second.

A ping program shows it. Type the figure you measured: nothing is measured here.

The data in one TCP segment. 1,460 bytes is usual on Ethernet: 1,500 bytes less 20 for the IP header and 20 for the TCP header.

Your values are worked out in this browser. They are not sent to a server.

Your result will show here

Fill in the values, then choose Calculate.

How to use this calculator

  1. Type the rate of the link and choose its unit. Use the rate of the slowest link on the path.
  2. Type the round-trip time. A ping program shows it.
  3. Change the largest segment size if yours is not 1,460 bytes.
  4. Choose Calculate. The result gives the window in bytes, the shift count it needs and the number of full segments.
  5. Use Largest rate that a window allows for the other direction, and Window scale to work with a shift count alone.

The formulas

  • Window that fills a path in bytes = rate in bits per second × round-trip time in seconds ÷ 8. This is the bandwidth-delay product.
  • Largest rate of a window in bits per second = window in bytes × 8 ÷ round-trip time in seconds.
  • Window scale: window = value of the window field × 2 to the power of the shift count. The field has 16 bits, so it holds at most 65,535.
  • Shift count for a window = the smallest count for which 65,535 × 2 to the power of the count is not below the window. The count goes from 0 to 14 (RFC 7323).
  • Largest TCP window = 65,535 × 16,384 = 1,073,725,440 bytes, which is just under 1 GiB.

Bits, bytes and units

One byte is 8 bits. Link rates are in bits per second, such as megabits per second (Mbit/s). Windows are in bytes. Decimal units are powers of 1000 (1 MB is 1,000,000 bytes) and binary units are powers of 1024 (1 MiB is 1,048,576 bytes). Settings of operating systems are in plain bytes.

Worked examples

Window: a link of 100 Mbit/s with a round-trip time of 80 ms needs 100,000,000 × 0.08 ÷ 8 = 1,000,000 bytes. That is 685 segments of 1,460 bytes.

Shift count: 1,000,000 bytes is above 65,535. A shift count of 3 allows 65,535 × 8 = 524,280 bytes, which is too small. A shift count of 4 allows 65,535 × 16 = 1,048,560 bytes, so 4 is needed. The field value is 1,000,000 ÷ 16 = 62,500.

Largest rate: a window of 65,535 bytes at 80 ms allows 65,535 × 8 ÷ 0.08 = 6,553,500 bits per second, which is 6.55 Mbit/s. On this path a connection without the window scale option cannot go faster, whatever the link rate is.

Scale: a window of 4 MiB is 4,194,304 bytes. A shift count of 6 allows 4,194,240 bytes, which is 64 bytes too few, so the shift count is 7.

Limits you should know

  • The window is one of several limits. The link rate, packet loss and the congestion control of the sender also limit a connection. The Network Throughput Calculator puts them side by side.
  • The figures are the same as in the Bandwidth Delay Product Calculator, seen from the side of the window.
  • Most systems now set the window by themselves. Check what your system does before you change a setting, and test after a change.
  • The shift count is fixed when a connection starts. Both sides must send the option, and a device on the path can remove it.
  • The result is a planning estimate from the figures you typed. Real round-trip times change with load and route.

Related tools