To open a port on Windows 11, press Windows key plus R, type wf.msc, open Inbound Rules, choose New Rule, select Port, pick TCP or UDP, enter the port number, choose Allow the connection, limit it to Private networks, name the rule and finish. For internet access, also forward the port on your router.
Key takeaways
- Opening a port means adding a narrow inbound rule to Windows Defender Firewall, not turning the firewall off.
- Use the app's exact port and protocol, limit the rule to Private networks, and close it when you no longer need it.
- If it works locally but not from the internet, the router is not forwarding the port or your provider blocks it.
Opening a port on Windows 11 sounds technical, but it is one simple idea: you tell Windows Defender Firewall to let a specific kind of traffic reach a specific app. Do it narrowly, and you stay safe. Do it carelessly, and you open a door you did not mean to.
What does opening a port mean?
Opening a port means adding an inbound rule to Windows Defender Firewall that allows traffic on one port, using one protocol, to reach your PC. It does not start an app, and it does not make your PC visible to the whole internet on its own.
Ports are numbered doors for network traffic, from 0 to 65535. Ports up to 1023 are reserved for well-known services, such as 443 for HTTPS, as listed in IANA's port registry. Your app's documentation should say which port and protocol it needs, for example TCP 25565 for a Minecraft server or TCP 32400 for Plex.
Windows blocks unsolicited inbound traffic by default and allows outbound traffic by default. That is why you rarely need an outbound rule, but you do need an inbound rule for a server or game that accepts connections. For background on your home network, see our guide to how to secure your Wi-Fi.
What should you check before you open a port?
Check four things before you touch the firewall: the exact port, the protocol, whether you need it at all, and whether you have an administrator account.
- Port and protocol: find them in the app or game's official documentation. Some apps need both TCP and UDP, which means two rules.
- Do you need it? Many apps ask Windows for permission the first time they run. If you already clicked Allow, the firewall may already be open for that app.
- Admin account: standard accounts cannot change firewall rules. Sign in as an administrator or ask your IT team.
- Scope: open the port on Private networks only unless you have a reason not to. Never open it on Public networks for a home server.
Microsoft says allowing a specific application is generally less risky than opening a port, because a port can remain available until the rule is disabled or deleted. Use a program rule when you can, and a port rule when the app has a fixed, documented port.
How do I open a port with Windows Security?
Use the advanced firewall console to create an inbound rule for a specific port, protocol, profile and optional scope. The example below uses port 25565; replace it with the port your app needs.
- Press Windows key + R, type
wf.msc, and press Enter. You can also search Start for Windows Defender Firewall with Advanced Security. - Select Inbound Rules in the left pane.
- Select New Rule in the right pane.
- Choose Port and select Next.
- Choose TCP or UDP. Under Specific local ports, type the port number, such as 25565. You can enter several ports separated by commas, or a range such as 27015-27030. Select Next.
- Choose Allow the connection and select Next.
- Choose the network types: Domain, Private and Public. For most home uses, select Private only. Select Next.
- Give the rule a clear name, such as Minecraft server TCP 25565, and select Finish.
The rule takes effect as soon as you select Finish; no restart is needed. If the app needs both TCP and UDP, repeat the steps and create a second rule for the other protocol.
How do I allow an app through the firewall instead?
Allowing an app is often safer than opening a port, because the rule follows the program rather than leaving a port open for any program. Use this when the app does not have a fixed, documented port.
- Open Windows Security from the Start menu.
- Select Firewall and network protection.
- Select Allow an app through firewall.
- Select Change settings. Administrator approval may be required.
- Check the application under the network profile it actually needs: Private, Public or Domain.
- If the application is not listed, select Allow another app, browse to the application's executable file, and add it.
- Select OK.
Use a specific port rule instead when a server or service has a documented fixed port and you need predictable, auditable behaviour.
How do I open a port with PowerShell?
PowerShell is faster if you set up servers often, and it gives you a repeatable command you can save. Open Terminal as administrator first by right-clicking Start.
Run this command, changing the name, protocol and port to match your app:
New-NetFirewallRule -DisplayName "Minecraft TCP 25565" -Direction Inbound -Protocol TCP -LocalPort 25565 -Action Allow -Profile Private
To remove the rule later, run Remove-NetFirewallRule -DisplayName "Minecraft TCP 25565". To list your rules, run Get-NetFirewallRule | Where-Object { $_.DisplayName -like "*Minecraft*" }.
You can also use Command Prompt as administrator with netsh: netsh advfirewall firewall add rule name="Minecraft TCP 25565" dir=in action=allow protocol=TCP localport=25565. PowerShell is the modern choice, and Microsoft documents both approaches in Windows Defender Firewall with Advanced Security.
How do I forward a port on my router?
The Windows firewall controls traffic that reaches your PC. If people outside your home need to connect, for example friends joining your game server, your router must also send that traffic to your PC. This is called port forwarding.
- Find your PC's local IP address: open Settings, then Network and internet, select your connection, and look for IPv4 address.
- Sign in to your router's settings page or app. The address and password are usually printed on a label on the router.
- Find the section called Port Forwarding, Virtual Server or NAT.
- Add a rule with the port number, protocol and your PC's IP address, then save.
Set a reserved, or static, IP address for your PC in the router as well. Otherwise the router may give your PC a new address later and the forwarding rule will stop working.
Opening one port is safer than turning the firewall off entirely. Never disable the firewall to make a game work; fix the rule instead.
How do I check that the port is open?
A port only shows as open when the app that uses it is running. Opening a port in the firewall does not start anything by itself, so start the app first.
- See whether an app is listening: in Command Prompt, run
netstat -ano | findstr :25565. A line with LISTENING means an app is waiting for connections on that port. - Test from another PC on your network: in PowerShell on the other PC, run
Test-NetConnection -ComputerName 192.168.1.20 -Port 25565, using your PC's IP address. TcpTestSucceeded: True means the port is reachable. - See which ports are open: run
netstat -anoin Command Prompt to list every listening port and the process ID using it.
You can also confirm your public address before testing from the internet with our free what-is-my-ip tool.
Why does my port still look closed?
Work through the layers in order: app, firewall, router, provider. Most failures are in the first two.
| Symptom | Most likely cause | Fix |
|---|---|---|
| Port closed locally | App not running or wrong protocol | Start the app; check TCP vs UDP |
| Works locally, not from internet | Router not forwarding | Add port forwarding; set a static IP |
| Rule does not apply | Wrong network profile | Match the rule to Private or Public as needed |
| New Rule is greyed out | Not an administrator | Sign in as admin or contact IT |
| Still blocked | Third-party firewall | Add the rule in that app instead |
| Internet access fails | Provider blocks or CGNAT | Check WAN address; contact provider |
If your network is set to Public but the rule is for Private, the rule does not apply. Change the network type in Settings, then Network and internet. If your provider uses carrier-grade NAT, incoming connections may be blocked entirely; check your router's WAN address against what an IP lookup site shows, and contact your provider if they differ.
How do I close a port again?
Close a port as soon as you no longer need it. An open port you forgot about is a door you left unlocked.
- Open
wf.mscand select Inbound Rules. - Find your rule by name. Select Name at the top to sort the list.
- Right-click it and select Disable Rule to turn it off temporarily, or Delete to remove it.
Review your inbound rules every few months. Delete rules for games and servers you no longer run, and keep a note of why each remaining rule exists.
Is it safe to open ports on Windows 11?
It is safe when you open only the ports an app needs, limit them to private networks, and close them when you are done. The risk comes from leaving ports open to the internet for software that is not kept up to date.
Never open Remote Desktop port 3389 directly to the internet, and never open a wide range of ports when one will do. If you need remote access, use a VPN or a remote-access tool with strong authentication instead.
Keep Windows updated, keep the app updated, and use a strong password for the app and for your router admin page. A port rule is only as safe as the software behind it.
The bottom line
To open a port on Windows 11, add a narrow inbound rule in Windows Defender Firewall, test it with the app running, and forward it on your router only if people outside your home need it.
Open one port, for one app, on Private networks, and close it when you are done. You can check your public address before testing from outside with the free what-is-my-ip tool.
Frequently asked questions
How do I open a port on Windows 11?
Press Windows key plus R, type wf.msc and press Enter. Select Inbound Rules, then New Rule, choose Port, pick TCP or UDP, type the port number, select Allow the connection, choose the network profiles and name the rule. You need an administrator account.
Is it safe to open ports on Windows 11?
It is safe when you open only the ports an app needs, limit them to private networks, keep the software updated and close them when you are done. The risk comes from leaving ports open to the internet for software that is not kept up to date.
What is the difference between TCP and UDP ports?
TCP is connection-based and confirms delivery, so it suits web servers, game servers and file transfers. UDP is faster with no delivery confirmation, so it suits voice, video and some game traffic. Check the app documentation for which one it needs.
Do I need to open a port on my router too?
Yes, if people outside your home need to connect. The Windows firewall only controls traffic that reaches your PC. Your router must also forward the port to your PC's local IP address, which is called port forwarding.
How do I check if a port is open on Windows 11?
First check the app is running and listening with netstat -ano in Command Prompt. Then test from another PC on your network with Test-NetConnection in PowerShell. A port only shows as open when the app using it is running.
How do I close a port on Windows 11?
Open wf.msc, select Inbound Rules, find your rule by name, right-click it and select Disable Rule to turn it off temporarily or Delete to remove it. In PowerShell, use Remove-NetFirewallRule with the rule's display name.
Why is my port still closed after opening it?
Check that the app is running and listening, that you chose the right protocol, and that your network profile matches the rule. If your network is Public but the rule is for Private, the rule does not apply. Also check your router forwarding and any third-party firewall.
Can I open a port with PowerShell?
Yes. Open Terminal as administrator and run New-NetFirewallRule with the display name, direction, protocol, local port, action and profile. For example, use -LocalPort 25565 for a Minecraft server, changing the name, protocol and port to match your app.
Sources
The engineers and analysts who build Cysoro's domain scanner, email-authentication checks and free security tools. We test what we write about every day — SPF, DKIM, DMARC, certificates, look-alike domains and phishing — and check each guide against the relevant standards, government guidance and vendor documentation.
Checked against Microsoft Learn documentation for Windows Defender Firewall with Advanced Security, IANA's port registry, and step-by-step guides updated in November 2026.
How we write and fact-check →