Change Remote Desktop Port in Windows 11 Registry

This guide explains how to change the default listening port for Remote Desktop Protocol (RDP) on Windows 11 using the Windows Registry. By default, Remote Desktop listens on port 3389, but changing this to a custom port helps obscure your system from automated network scans and unauthorized access attempts. Below are the direct steps to modify the registry, update the firewall, and apply the changes.

Step 1: Open the Windows Registry Editor

  1. Press Windows Key + R to open the Run dialog box.
  2. Type regedit and press Enter (or click OK).
  3. Click Yes if prompted by User Account Control (UAC).

Step 2: Navigate to the RDP-Tcp Registry Key

In the Registry Editor address bar, paste the following path and press Enter:

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp

Step 3: Modify the PortNumber Value

  1. In the right pane of the RDP-Tcp folder, locate the DWORD entry named PortNumber.
  2. Double-click PortNumber to open its edit window.
  3. Under the Base section, select the Decimal radio button.
  4. In the Value data field, enter your desired port number (choose an unused port between 1024 and 65535).
  5. Click OK to save the change.

Step 4: Update Windows Defender Firewall

Changing the registry alone will cause incoming connections on the new port to be blocked by the firewall. You must open the new port:

  1. Right-click the Start button and select Terminal (Admin) or PowerShell (Admin).
  2. Run the following command, replacing <PortNumber> with the port you specified in the registry:
New-NetFirewallRule -DisplayName "Remote Desktop Custom Port" -Direction Inbound -LocalPort <PortNumber> -Protocol TCP -Action Allow
  1. Press Enter to execute the rule.

Step 5: Restart the Remote Desktop Service or PC

To make the new listening port active, restart your computer, or restart the Remote Desktop service via PowerShell with this command:

Restart-Service -Name TermService -Force

Connecting via the New Port

When connecting to this Windows 11 computer using the Remote Desktop Connection client (mstsc), specify the IP address or hostname followed by a colon and the new port number (e.g., 192.168.1.100:3390).