RDP port 3389: what it is and how to change it

Remote Desktop (RDP) listens on TCP port 3389 by default, and newer Windows versions also use UDP 3389 to make the connection smoother. You can move RDP to another port in a few minutes, but do it in the right order or you’ll lock yourself out of your own server.

What port 3389 does

When you connect with Remote Desktop Connection or the Windows App, your device knocks on the server’s IP address at port 3389. The Remote Desktop Services service on the server answers there, checks your username and password, and opens your session.

Because every Windows server uses the same default port, bots scan the internet for 3389 all day and try common passwords on whatever answers. That’s the main reason people change it.

Check which port your server uses

Open PowerShell on the server as Administrator and run:

Get-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp' -Name PortNumber

The PortNumber value is the port RDP listens on. If it says 3389, the server is on the default.

How to change the RDP port

Pick a free port between 1024 and 65535, such as 50123, and avoid ports other software already uses. Then follow these steps in this order.

  1. Open the new port in Windows Firewall first. If you skip this, the server stops answering after the restart.
  2. Change the port in the registry.
  3. Restart Remote Desktop Services, or reboot the server.
  4. Connect on the new port before you close the old firewall rule.

In PowerShell as Administrator, steps 1 to 3 look like this:

$port = 50123
New-NetFirewallRule -DisplayName "RDP $port TCP" -Direction Inbound -Protocol TCP -LocalPort $port -Action Allow
New-NetFirewallRule -DisplayName "RDP $port UDP" -Direction Inbound -Protocol UDP -LocalPort $port -Action Allow
Set-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp' -Name PortNumber -Value $port
Restart-Service TermService -Force

Restarting the service drops your current session. Wait a minute, then reconnect on the new port.

Connect on the new port

Add the port to the address with a colon. In Remote Desktop Connection on Windows, type 203.0.113.10:50123 in the Computer box, using your server’s IP. The Windows App on Mac, iPhone and Android takes the same IP:port format in the PC name field.

If the connection works, you can remove the old 3389 rule from Windows Firewall. If it doesn’t, check that the firewall rule exists and that the port number in the registry matches what you typed.

Locked out? What to do

If you changed the port before opening it in the firewall, you can’t reach the server over RDP any more. Open a support ticket from your client area with the server’s IP and the port you set, and we’ll help you get back in.

Does changing the port make RDP secure?

Not on its own. A new port cuts the automated scans and failed logins in your event log, but anyone who scans all ports can still find it. What actually protects the server:

  • A long, unique password for every account, and no shared logins.
  • Network Level Authentication (NLA) turned on, so a login is checked before a full session starts.
  • Windows updates installed promptly.
  • If you connect from a fixed IP address, a firewall rule that only allows that address on your RDP port.

Every RDP plan here comes with full administrator access, so you can change the port, the firewall and any other setting yourself.