Opening a port in Windows 11 means adding a Windows Defender Firewall rule that lets traffic reach a program on a specific port number, such as a game server or a remote-access tool. Only open the ports an app actually needs, and close them again when you’re done. This guide covers the Firewall settings, a one-line PowerShell command, how to test the port, and what to do on your router.
Quick answer
Press Windows+R, type wf.msc, and press Enter. Select Inbound Rules > New Rule > Port, choose TCP or UDP, enter the port number, choose Allow the connection, pick the network profiles, and name the rule.
Method 1: Windows Defender Firewall with Advanced Security
- Press Windows+R, type
wf.msc, and press Enter (or search Start for “Windows Defender Firewall with Advanced Security”). - Select Inbound Rules in the left pane, then New Rule on the right.
- Choose Port and select Next.
- Choose TCP or UDP (check the app’s documentation; some need both, which means two rules).
- Select Specific local ports and enter the number, such as 25565. Use commas for several ports or a hyphen for a range.
- Choose Allow the connection.
- Tick only the profiles you need. Private is usually right for a home network; avoid Public unless you must.
- Give the rule a clear name, like “Minecraft server TCP 25565”, and select Finish.
Method 2: PowerShell (one command)
Open Terminal as administrator and run:
New-NetFirewallRule -DisplayName "Minecraft TCP 25565" -Direction Inbound -Protocol TCP -LocalPort 25565 -Action Allow -Profile Private
Change the name, protocol, port, and profile to suit. To remove it later, run Remove-NetFirewallRule -DisplayName "Minecraft TCP 25565".
Common ports
| Port | Protocol | Used by |
|---|---|---|
| 80 / 443 | TCP | Web servers (HTTP / HTTPS) |
| 3389 | TCP | Remote Desktop (Windows turns this on for you when you enable Remote Desktop) |
| 25565 | TCP | Minecraft Java Edition server |
| 19132 | UDP | Minecraft Bedrock Edition server |
| 21 | TCP | FTP servers |
Always confirm the port in the app’s own documentation; many apps let you choose a custom port.
Test that the port is open
- Start the app that should be listening.
- In Command Prompt, run
netstat -ano | findstr :25565. A line ending in LISTENING means the app is waiting for connections. - From another PC on your network, run
Test-NetConnection -ComputerName 192.168.1.20 -Port 25565in PowerShell, using your PC’s IP address. TcpTestSucceeded : True means the firewall is letting traffic in.
More ways are in how to check if a port is open on Windows.
Opening a port to the internet
A firewall rule only opens the port on your PC. For people outside your home to connect, you also need port forwarding on your router, which sends traffic for that port to your PC’s local IP address. Set a reserved (static) IP for the PC first so the rule keeps working. Exposing a port to the internet makes the app reachable by anyone, so keep it updated and use strong passwords; never forward Remote Desktop (3389) directly.
Troubleshooting
- Still blocked: Check that the rule is enabled, uses the right protocol, and covers the network profile your connection uses (Settings > Network & internet shows Public or Private).
- Third-party antivirus: Products like Norton or Bitdefender may run their own firewall that needs a separate rule.
- Nothing is listening: If netstat shows no LISTENING line, the app isn’t running or uses a different port.
Close the port when you’re done
In wf.msc, right-click the rule and choose Disable Rule or Delete. See closing ports on Windows for more. If you were thinking of turning the firewall off entirely to get an app working, a port rule is much safer; if you must, see how to disable the firewall on Windows 11.
Frequently asked questions
Is opening a port safe?
It’s safe when the app is trustworthy and up to date, and the rule is limited to the Private profile. Each open port is another way into your PC, so don’t leave unused rules in place.
Do I need an outbound rule?
Usually not. Windows Firewall allows outbound traffic by default.
Does this work on Windows 10?
Yes. wf.msc and the PowerShell command are the same on Windows 10.

Kermit Matthews is a freelance writer based in Philadelphia, Pennsylvania with more than a decade of experience writing technology guides. He has a Bachelor’s and Master’s degree in Computer Science and has spent much of his professional career in IT management.
He specializes in writing content about iPhones, Android devices, Microsoft Office, and many other popular applications and devices.