Most of these settings were mentioned on SpeedGuide.net and MajorGeek.com.
Last active
May 18, 2026 13:26
-
-
Save asheroto/942db6b331db8f070472990da6e6e1db to your computer and use it in GitHub Desktop.
Adjusts various TCP and network settings in Windows to enhance the speed of the Internet connection.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #Requires -RunAsAdministrator | |
| <# | |
| .SYNOPSIS | |
| Network performance optimization script for Windows 10/11. | |
| .DESCRIPTION | |
| Applies TCP and network stack tweaks targeting lower latency. | |
| Skips settings that are read-only or no-ops on Windows 10/11 consumer editions. | |
| Run in an elevated PowerShell session. | |
| .NOTES | |
| Test your connection before and after with a tool like ping, winMTR, or iPerf. | |
| A reboot is recommended after running this script. | |
| #> | |
| Set-StrictMode -Version Latest | |
| $ErrorActionPreference = 'Stop' | |
| function Write-Step { | |
| param([string]$Message) | |
| Write-Host "`n>> $Message" -ForegroundColor Cyan | |
| } | |
| function Write-Skip { | |
| param([string]$Message) | |
| Write-Host " SKIPPED: $Message" -ForegroundColor DarkGray | |
| } | |
| # --------------------------------------------- | |
| # SECTION 1 - TCP Global Settings (netsh) | |
| # These apply on Windows 10/11 and have measurable effect. | |
| # --------------------------------------------- | |
| Write-Step "Setting congestion provider." | |
| # CTCP (Compound TCP) can improve throughput on higher-latency links. | |
| # Alternative: bbr2 is theoretically better but has known bugs on Windows | |
| # and may break VPN/proxy tools. Stick with ctcp unless you want to experiment. | |
| # To try BBR2: netsh int tcp set supplemental template=internet congestionprovider=bbr2 | |
| netsh int tcp set supplemental template=internet congestionprovider=ctcp | Out-Null | |
| Write-Step "Disabling TCP timestamps." | |
| # Reduces per-packet overhead. Minor latency benefit on LAN/low-latency links. | |
| netsh int tcp set global timestamps=disabled | Out-Null | |
| Write-Step "Setting initial Retransmission Timeout (RTO) to 300ms." | |
| # Default is 1000ms. 300ms is the minimum and benefits low-latency connections | |
| # by retrying faster on packet loss without waiting a full second. | |
| netsh int tcp set global initialRto=300 | Out-Null | |
| Write-Step "Disabling Receive Segment Coalescing (RSC) globally." | |
| # RSC batches incoming segments to reduce CPU load, but adds latency. | |
| # Disable for lower latency; re-enable if you prioritize throughput over latency. | |
| netsh int tcp set global rsc=disabled | Out-Null | |
| Write-Step "Enabling RSS and Direct Cache Access (DCA) globally." | |
| # RSS (Receive-Side Scaling) spreads network processing across CPU cores. | |
| # DCA (Direct Cache Access) can reduce memory latency - requires hardware support | |
| # (Intel VT-d / DCA-capable NIC). Safe to enable; silently ignored if unsupported. | |
| netsh int tcp set global rss=enabled dca=enabled | Out-Null | |
| Write-Step "Disabling Non-SACK RTT Resiliency globally." | |
| # Reduces unnecessary retransmits on modern networks where SACK is standard. | |
| netsh int tcp set global nonsackrttresiliency=disabled | Out-Null | |
| Write-Step "Setting maximum SYN retransmissions to 2." | |
| # Default is 4. Reduces the time spent waiting for a response from a dead host. | |
| netsh int tcp set global maxsynretransmissions=2 | Out-Null | |
| # --------------------------------------------- | |
| # SECTION 2 - Dynamic Port Range | |
| # --------------------------------------------- | |
| Write-Step "Setting dynamic port range (IPv4 and IPv6)." | |
| # Expands the ephemeral port pool. Useful under heavy connection load. | |
| # Start at 10000 with 55534 ports (up to 65534) for maximum range. | |
| netsh int ipv4 set dynamicport tcp start=10000 num=55534 | Out-Null | |
| netsh int ipv6 set dynamicport tcp start=10000 num=55534 | Out-Null | |
| # --------------------------------------------- | |
| # SECTION 3 - Network Adapter Offload Settings | |
| # --------------------------------------------- | |
| Write-Step "Disabling TCP Chimney Offload globally." | |
| # TCP Chimney is deprecated and disabled by default in modern Windows. | |
| # Explicitly disabling it ensures no legacy path activates it. | |
| Set-NetOffloadGlobalSetting -Chimney Disabled | Out-Null | |
| Write-Step "Enabling Checksum Offload on all network adapters." | |
| # Offloads checksum computation to the NIC, reducing CPU overhead. | |
| Enable-NetAdapterChecksumOffload -Name * -ErrorAction SilentlyContinue | Out-Null | |
| Write-Step "Enabling Receive-Side Scaling (RSS) on all network adapters." | |
| Enable-NetAdapterRss -Name * -ErrorAction SilentlyContinue | Out-Null | |
| Write-Step "Disabling Receive Segment Coalescing (RSC) on all network adapters." | |
| # Per-adapter RSC disable to match the global setting above. | |
| Disable-NetAdapterRsc -Name * -ErrorAction SilentlyContinue | Out-Null | |
| Write-Step "Disabling Large Send Offload (LSO) on all network adapters." | |
| # LSO can introduce latency spikes by batching large sends. Disable for | |
| # more consistent low-latency behavior. Re-enable if throughput suffers. | |
| Disable-NetAdapterLso -Name * -ErrorAction SilentlyContinue | Out-Null | |
| Write-Step "Disabling Packet Coalescing Filter globally." | |
| Disable-NetAdapterPacketDirect -Name * -ErrorAction SilentlyContinue | Out-Null | |
| Set-NetOffloadGlobalSetting -PacketCoalescingFilter Disabled | Out-Null | |
| # --------------------------------------------- | |
| # SECTION 4 - Registry: TCP/IP Parameters | |
| # --------------------------------------------- | |
| Write-Step "Setting TCP/IP registry parameters." | |
| # Standard TTL of 64 (Linux/macOS default). Reduces unnecessary router hops | |
| # before packet expiry. 128 is the Windows default - 64 is more RFC-standard. | |
| reg add "HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters" /t REG_DWORD /v DefaultTTL /d 64 /f | Out-Null | |
| # Maximizes the ephemeral port ceiling (65534 is the max valid port). | |
| reg add "HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters" /t REG_DWORD /v MaxUserPort /d 65534 /f | Out-Null | |
| # Reduces TIME_WAIT state from 240s default to 30s. | |
| # Frees up ports faster after connections close. Safe for client machines. | |
| reg add "HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters" /t REG_DWORD /v TcpTimedWaitDelay /d 30 /f | Out-Null | |
| # --------------------------------------------- | |
| # SECTION 5 - Registry: DNS Resolution Priority | |
| # --------------------------------------------- | |
| Write-Step "Setting DNS resolution priority order." | |
| # Lower number = higher priority. This order: local hosts file first, | |
| # then local (mDNS/NetBT), then DNS, then NetBT fallback. | |
| # Speeds up local hostname resolution and reduces unnecessary DNS queries. | |
| reg add "HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\ServiceProvider" /v "LocalPriority" /t REG_DWORD /d 4 /f | Out-Null | |
| reg add "HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\ServiceProvider" /v "HostsPriority" /t REG_DWORD /d 5 /f | Out-Null | |
| reg add "HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\ServiceProvider" /v "DnsPriority" /t REG_DWORD /d 6 /f | Out-Null | |
| reg add "HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\ServiceProvider" /v "NetbtPriority" /t REG_DWORD /d 7 /f | Out-Null | |
| # --------------------------------------------- | |
| # DONE | |
| # --------------------------------------------- | |
| Write-Host "`n---------------------------------------------" -ForegroundColor Green | |
| Write-Host " Network optimization complete. Reboot recommended." -ForegroundColor Green | |
| Write-Host "---------------------------------------------" -ForegroundColor Green | |
| Write-Host "" | |
| Write-Host " To verify TCP global settings after reboot:" -ForegroundColor Yellow | |
| Write-Host " netsh int tcp show global" -ForegroundColor White | |
| Write-Host "" | |
| Write-Host " To revert congestion provider to Windows default (Cubic):" -ForegroundColor Yellow | |
| Write-Host " netsh int tcp set supplemental template=internet congestionprovider=default" -ForegroundColor White | |
| Write-Host "" |
Author
@imba-tjd thanks for the info. You are correct, it's useless on Windows 10/11.
I've updated the script with several changes, including adding the commands you mentioned which should help.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The three Set-NetTCPSetting is useless unless you are using winserver. See https://learn.microsoft.com/en-us/powershell/module/nettcpip/set-nettcpsetting?view=windowsserver2025-ps#description Besides your value is the default value on my win11.
Personally I think none of these options are valid under normal internet connection.
If you are optimizing for low latency network (rather than high bandwidth), I think these may help (no guarantee):
dca=enabled: may be useful. But its status doesn't show up in mynetsh int tcp show global. AI says it needs hardware support.netsh int tcp set supplemental template=internet congestionprovider=bbr2: theoretically better than cubic both on internet and home LAN. But the windows implementation has been buggy, which may cause network worse. Have a try. If not good, switch to cubic (default on win11). I have tested that it's not compatible with my proxy tool.