> ## Documentation Index
> Fetch the complete documentation index at: https://help.freakhosting.com/llms.txt
> Use this file to discover all available pages before exploring further.

# How to Change the RDP Port on Windows Server

> Change the RDP port on Windows Server: allow the new port in Windows Firewall first, set PortNumber in the RDP-Tcp registry key, restart, then connect with IP:port.

To change the RDP port on Windows Server, first allow the new port (for example `3390`) in Windows Defender Firewall with `New-NetFirewallRule`, then set `PortNumber` under `HKLM:\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp` to the new value and restart the server. Connect afterwards with `203.0.113.10:3390`. Remote Desktop listens on port `3389` by default. Do the firewall step first, or you lock yourself out.

| Difficulty | Time | Works on | Needs |
| - | - | - | - |
| Intermediate | 10 minutes | Windows Server 2019 / 2022 / 2025 | Administrator account, VNC console access as a fallback |

## Before you start

* Sign in as an administrator with [Remote Desktop](https://help.freakhosting.com/portals/other/how-to-connect-to-windows-server-with-remote-desktop.md).
* Open the [VNC console](https://help.freakhosting.com/portals/vps-panel/how-to-enable-and-use-vnc-console-access.md) in a second browser tab and check that you can sign in there. If anything goes wrong, this is how you get back in. On a dedicated server without console access, [open a ticket](https://freakhosting.com/clientarea/submitticket.php) for KVM access before you start.
* Pick a port between `1024` and `65535` that nothing else on the server uses. Check it is free:

```powershell theme={null}
Get-NetTCPConnection -LocalPort 3390 -ErrorAction SilentlyContinue
```

No output means nothing is listening on `3390`.

> [!WARNING]
>
> Changing the RDP port can lock you out. Always follow this order: **1. firewall rule**, **2. registry**, **3. restart**, **4. test the new port**, **5. only then remove the old rule**. If you also filter traffic in the [Firewall panel](https://help.freakhosting.com/portals/firewall/firewall-panel-overview.md) or another external firewall, allow the new port there first too.

## Does changing the RDP port make the server secure?

Not by itself. A different port cuts down the noise from bots that only scan `3389`, but anyone scanning all ports still finds RDP. Keep a strong password, Network Level Authentication and an account lockout policy, and limit RDP to your own IP where you can. See [protect RDP from brute-force attacks](https://help.freakhosting.com/portals/other/how-to-protect-rdp-from-brute-force-attacks.md).

## How to change the RDP port with PowerShell

Open PowerShell as administrator: select **Start**, type `PowerShell`, right-click **Windows PowerShell** and choose **Run as administrator**.

**1. Check the current port**

```powershell theme={null}
Get-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp' -Name 'PortNumber'
```

The output shows `PortNumber : 3389` on a default installation.

**2. Allow the new port in Windows Firewall (first!)**

```powershell theme={null}
$portValue = 3390
New-NetFirewallRule -DisplayName 'RDP custom port TCP-In' -Direction Inbound -Action Allow -Protocol TCP -LocalPort $portValue -Profile Any
New-NetFirewallRule -DisplayName 'RDP custom port UDP-In' -Direction Inbound -Action Allow -Protocol UDP -LocalPort $portValue -Profile Any
```

Microsoft's instructions add one TCP and one UDP rule for the new port ([Microsoft Learn](https://learn.microsoft.com/en-us/windows-server/remote/remote-desktop-services/remotepc/change-listening-port)). `-Profile Any` makes the rule apply whichever network profile Windows has given your network adapter.

**3. Check the rules exist**

```powershell theme={null}
Get-NetFirewallRule -DisplayName 'RDP custom port*' | Format-Table DisplayName, Enabled, Direction, Action
```

Both rules show `Enabled True`, `Inbound`, `Allow`.

**4. Change the port in the registry**

```powershell theme={null}
Set-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp' -Name 'PortNumber' -Value $portValue
```

Run the first command again to confirm it now shows `3390`.

**5. Restart the server**

```powershell theme={null}
Restart-Computer
```

Your Remote Desktop session ends. Wait one or two minutes for Windows to start again.

**6. Connect on the new port**

In **Remote Desktop Connection**, enter the IP address, a colon and the port, for example `203.0.113.10:3390`.

## How to change the RDP port in Registry Editor

If you prefer a window to PowerShell, still create the firewall rules from step 2 above first. Then:

**1. Open Registry Editor**

Select **Start**, type `Registry Editor` and open it.

**2. Go to the RDP-Tcp key**

Navigate to `HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp`.

**3. Edit PortNumber**

Select `PortNumber`, then **Edit > Modify**. Select **Decimal**, type `3390` and select **OK**.

**4. Restart**

Close Registry Editor and restart the server.

> [!WARNING]
>
> Select **Decimal** before typing the port. If **Hexadecimal** is selected, `3390` is read as a hexadecimal number and RDP ends up on a different port.

## How to check it worked

From your own computer, test the port before you connect (PowerShell on Windows):

```powershell theme={null}
Test-NetConnection -ComputerName 203.0.113.10 -Port 3390
```

`TcpTestSucceeded : True` means the port is open and Remote Desktop is listening. Then sign in with `203.0.113.10:3390`. See also [check if a port is open from outside](https://help.freakhosting.com/portals/other/how-to-check-if-a-port-is-open-from-outside.md).

Once the new port works, you can close port 3389: run `wf.msc`, open **Inbound Rules**, sort by **Local Port**, then right-click each enabled Remote Desktop rule on port `3389` and choose **Disable Rule**. Enable them again if you ever change back.

## What to do if you are locked out

1. Open the [VNC console](https://help.freakhosting.com/portals/vps-panel/how-to-enable-and-use-vnc-console-access.md) and sign in as Administrator.
2. Open PowerShell as administrator.
3. Either add the missing firewall rule for the new port (step 2 of the PowerShell method), or set the port back to 3389 with the commands below. If you already disabled the port 3389 rules, enable them again in `wf.msc` first.
4. Restart, then connect on `203.0.113.10` (port 3389) again.

```powershell theme={null}
Set-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp' -Name 'PortNumber' -Value 3389
Restart-Computer
```

If you can't reach the console on a dedicated server, [open a ticket](https://freakhosting.com/clientarea/submitticket.php).

## Frequently asked questions

### What is the default RDP port?

TCP and UDP `3389`. Microsoft stores it in the `PortNumber` value of the `RDP-Tcp` registry key.

### Do I have to restart the whole server?

Microsoft's instructions end with a restart of the computer, so that is the reliable way to make Remote Desktop listen on the new port.

### Which port should I choose?

Any free port from `1024` to `65535` that isn't used by your software, for example `3390` or `33890`. Avoid well-known ports such as `80`, `443` or `1433`, and ports your game server uses.

### How do I connect on the new port from a Mac or phone?

Add the port to the PC name or address, for example `203.0.113.10:3390`, in Windows App or the Remote Desktop client.

## Related guides

> [card] [VPS and dedicated server guides](https://help.freakhosting.com/portals/other/vps-and-dedicated-server-guides.md)
>
> Every guide in this section.

> [card] [Protect RDP from brute force](https://help.freakhosting.com/portals/other/how-to-protect-rdp-from-brute-force-attacks.md)
>
> Lockout policy and IP limits.

> [card] [Open a port in Windows Firewall](https://help.freakhosting.com/portals/other/how-to-open-a-port-in-windows-firewall.md)
>
> Inbound rules explained.

> [card] [Fix Remote Desktop can't connect](https://help.freakhosting.com/portals/other/how-to-fix-remote-desktop-cant-connect.md)
>
> Step-by-step checks.

> [card] [Use the VNC console](https://help.freakhosting.com/portals/vps-panel/how-to-enable-and-use-vnc-console-access.md)
>
> Your way back in if RDP fails.

***

> [!NOTE]
>
> **Checked against Microsoft Learn: [Change the Remote Desktop listening port](https://learn.microsoft.com/en-us/windows-server/remote/remote-desktop-services/remotepc/change-listening-port), [New-NetFirewallRule](https://learn.microsoft.com/powershell/module/netsecurity/new-netfirewallrule) and [Test-NetConnection](https://learn.microsoft.com/powershell/module/nettcpip/test-netconnection)** on 4 November 2026. Not tested on a live Windows server for this page.

> [!NOTE]
>
> ### Need Extra Help?
>
> If you encounter any issues, our support team is ready to assist:
>
> * **Live Chat:** Quick assistance via our website.
> * **Support Ticket:** [Open a Ticket](https://freakhosting.com/clientarea/submitticket.php)
> * **Discord:** [Join our Community](https://discord.gg/freakhosting)
> * **Email:** [support@freakhosting.com](mailto:support@freakhosting.com)

> [!TIP]
>
> ### Save on Your Hosting
>
> Ready to upgrade your hosting? Use code **KB20** at checkout for **20% off** your first order!

***

**Last Updated:** November 2026


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.