TCP Window Size Calculator – Optimize Network Throughput
TCP window size is one of the most frequently misunderstood bottlenecks in high-performance networking. When the window is too small, the sender is forced to stop transmitting and wait for acknowledgements, leaving expensive link capacity idle. This calculator determines the ideal TCP receive window size for any link by computing the Bandwidth-Delay Product (BDP), checks whether the standard 16-bit TCP window is sufficient, recommends the appropriate RFC 1323 Window Scale factor, and can estimate throughput under packet loss using the Mathis formula.
What is the TCP Window Size?
The TCP receive window is the maximum amount of unacknowledged data a receiver will accept before requiring an ACK from the receiver. It acts as a flow-control buffer between sender and receiver. TCP’s original 16-bit window field caps at 65,535 bytes — a size chosen in 1981 when 10 Mbps Ethernet at sub-millisecond latency was considered fast. On modern links, this cap can strangle throughput dramatically.
How Is the Ideal Window Size Calculated?
The minimum window needed to keep a link fully utilised equals the Bandwidth-Delay Product (BDP):
Ideal Window (bytes) = (Bandwidth_bps ÷ 8) × RTT_seconds
For a 1 Gbps link with 50 ms RTT, BDP = (1,000,000,000 ÷ 8) × 0.05 = 6,250,000 bytes (~6.25 MB). Any window below this causes the sender to stall, capping throughput at Window × 8 ÷ RTT rather than the full link speed.
RFC 1323 TCP Window Scaling
RFC 1323 (updated as RFC 7323) defines the TCP Window Scale option, which shifts the 16-bit window field left by a scale exponent n (0–14). This raises the effective maximum window to:
Max Window = 65,535 × 2ⁿ
For the 6.25 MB example above, the minimum n that covers the BDP is n = 7 (scaled max = 65,535 × 128 ≈ 8.39 MB). Window scaling is negotiated during the TCP three-way handshake and is widely supported by all modern operating systems.
Throughput Efficiency Analysis
The efficiency mode computes what fraction of the link’s capacity is actually achievable with a given window size:
Throughput = Window_bytes × 8 ÷ RTT_seconds
Efficiency (%) = Throughput ÷ Bandwidth × 100
A 64 KB window on a 1 Gbps / 50 ms path achieves only ~10.5 Mbps — just 1.05% efficiency. Network engineers routinely encounter this on WAN links, satellite connections, and data-centre cross-connects where the default OS buffers were never tuned.
Packet-Loss-Aware Throughput (Mathis Formula)
On wireless, satellite, or congested links, random packet loss further constrains TCP throughput. The Mathis model provides a closed-form estimate:
Throughput ≈ (MSS × √(2/3)) ÷ (RTT × √p)
where p is the packet loss probability. At 0.1% loss (p = 0.001), MSS 1460 bytes, and 50 ms RTT, the model predicts approximately 507 Kbps — far below what the BDP alone would suggest. This formula is useful for planning satellite links, LPWAN infrastructure, or oversubscribed cellular backhaul.
OS Socket Buffer Sizing
Even if TCP negotiates a large window, the OS kernel must be configured to allocate socket buffers at least as large. Default Linux socket buffers are typically 128 KB–256 KB. On a link where the ideal window is 6 MB, the OS buffer is only 4% of what is needed. The calculator compares your OS buffer against the ideal window and generates ready-to-apply Linux sysctl commands that set net.core.rmem_max, net.core.wmem_max, net.ipv4.tcp_rmem, and net.ipv4.tcp_wmem to 2× the BDP with a safety margin. On macOS, the equivalent setting is net.inet.tcp.recvspace.
Window Scale Factor Reference Table
The scale factor table (n = 0–14) shows the maximum window achievable at each exponent and highlights which exponents cover the calculated BDP. This helps network engineers quickly identify the appropriate tcp_window_scaling setting without manual arithmetic.
Practical Use Cases
Network engineers use TCP window sizing calculations when diagnosing throughput ceilings on WAN links, tuning bulk data transfer applications such as SCP or FTP, configuring satellite ground stations, optimising data-centre storage replication over long-haul circuits, and troubleshooting cloud VPN tunnels with unexpectedly low throughput. Developers building real-time streaming or large-file-transfer systems also use BDP calculations to size application send buffers.
Tips for Maximising TCP Throughput
Always enable TCP Window Scaling (net.ipv4.tcp_window_scaling=1 on Linux — it is on by default in modern kernels). Raise socket buffer limits to at least 2× the BDP. For satellite or high-latency links, consider protocols designed for lossy high-BDP paths such as BBR congestion control or QUIC, which handle window management internally. For bulk transfers in trusted networks, jumbo frames (MTU 9000) increase the MSS and reduce per-segment overhead, improving efficiency at the same window size.