How to Change RDP Port Using Regedit

By default, Windows Remote Desktop Protocol (RDP) listens on port 3389. Modifying this default port via the Windows Registry Editor (Regedit) is a common practice to obscure the service from automated port scans and unauthorized access attempts. This guide provides a straightforward, step-by-step walkthrough to change the RDP listening port, configure the Windows Firewall to prevent lockout, and apply the new settings.

Step 1: Open the Registry Editor

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

Step 2: Locate the RDP Port Registry Key

Navigate to the following registry subkey using the left navigation pane:

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

Step 3: Modify the PortNumber Value

  1. In the right pane, find and double-click the DWORD value named PortNumber.
  2. In the edit window, change the Base option to Decimal.
  3. In the Value data field, enter your desired port number (choose an unused port between 1024 and 65535).
  4. Click OK to save the changes.

Step 4: Update the Windows Firewall

Before restarting the service, you must allow the new port through the Windows Firewall to avoid being locked out of the machine.

  1. Open the Start menu, search for Windows Defender Firewall with Advanced Security, and open it.
  2. Select Inbound Rules in the left pane and click New Rule… in the right pane.
  3. Choose Port and click Next.
  4. Select TCP, choose Specific local ports, and enter the new port number you configured in the registry. Click Next.
  5. Select Allow the connection and click Next.
  6. Ensure Domain, Private, and Public are checked (or according to your network requirements) and click Next.
  7. Provide a name for the rule (e.g., Custom RDP Port) and click Finish.

Step 5: Apply Changes

For the changes to take effect, you must restart the Remote Desktop service or reboot the computer.

To restart the service manually: 1. Press Windows Key + R, type services.msc, and press Enter. 2. Locate Remote Desktop Services in the list. 3. Right-click the service and select Restart.

Step 6: Connect Using the New Port

When connecting to the computer using the Remote Desktop Connection client (mstsc), you must now specify the custom port by appending a colon and the port number to the IP address or hostname:

192.168.1.100:3390 or computername:3390