Open Port in Windows Firewall in Windows 10

Windows Defender Firewall is a great feature in modern Windows versions. It was introduced in Windows XP and improved in Windows XP Service Pack 2. In Windows 10, it is part of the Windows Security app (formerly Windows Defender Security Center). Today, we will see how to open a port in Windows Firewall in Windows 10 for an app or a service.


In Windows 10, Windows Firewall is based completely on the Windows Filtering Platform API and has IPsec integrated with it. This is true since Windows Vista where the firewall added outbound connection blocking and also comes with an advanced Control Panel called Windows Firewall with Advanced Security. It gives fine-grained control over configuring the firewall. The Windows Firewall supports multiple active profiles, co-existence with third-party firewalls, and rules based on port ranges and protocols.

You may have an app (e.g a local FTP server) which requires a port(s) to be open so other computers on your network can connect to it.

Before you open or close ports in the Windows Firewall, ensure that you are signed in as an administrator.

To open a port in Windows Firewall in Windows 10, do the following.

  1. Open Windows Security.
  2. Click on the icon Firewall & network protection.Windows 10 Windows Security Network
  3. On the next page, click on the link Advanced settings.Windows 10 Windows Security Network Advanced Settings Link
  4. Click on Inbound Rules on the left.
  5. On the right, click on the New Rule link.Firewall Inbound Rules New Rule
  6. Select Port as the rule type and click Next.Firewall Rule Type Port
  7. Fill in the Specific local ports box. Type there the required port number or a range of ports. Set the required network protocol (TCP or UDP) and click Next.Firewall Rule Port Value
  8. On the next page, select the option Allow the connection. Click Next.Firewall Rule Allow The Connection
  9. Select the Windows Firewall profile the new rule should apply to. E.g. leaving the Private profile enabled and disabling others will make your app available only on home networks.Firewall Rule Select Firewall Profiles
  10. On the next page, provide some meaningful description for your firewall rule. Click on the Finish button.Firewall Rule Name

Voila, you have opened the inbound port in Windows 10 Firewall.

The same can be done for an outbound port if it is required by your app. In Windows Firewall with Advanced Security, click on the Outbound Rules instead of Inbound Rules and follow the wizard.Firewall Open Outbound Port

Finally, to close the opened port, remove the rule or just disable it.

Firewall Delete Rule

The change will take effect instantly.

There are a couple alternative methods you can use to open a port in Windows 10. Let's review them.

Open a port using netsh

Netsh is a console utility which allows changing a lot of network related parameters. Here are just a few examples of what you can do with netsh:

To open a port using netsh, do the following.

  1. Open an elevated command prompt.
  2. Type the following command: netsh advfirewall firewall add rule name="TCP Port 6624" dir=in action=allow protocol=TCP localport=6624. Modify the appropriate values to match your app, e.g. the port number, the rule name, the protocol (TCP or UDP).
  3. To delete the rule, execute the command as follows. netsh advfirewall firewall delete rule name="TCP Port 6624" protocol=TCP localport=6624.

Open a port using PowerShell

PowerShell is an advanced form of command prompt. It is extended with a huge set of ready-to-use cmdlets and comes with the ability to use .NET framework/C# in various scenarios. You can use it to open or close a port in Windows 10.

There is a special cmdlet New-NetFirewallRule that can be used to open or block a network port in Windows 10.

To open a port with PowerShell,

  1. Open an elevated PowerShell instance.
  2. Type the following command:
    New-NetFirewallRule -DisplayName 'My port' -Profile 'Private' -Direction Inbound -Action Allow -Protocol TCP -LocalPort 6624

That's it.

Articles of interest:

Support us

Winaero greatly relies on your support. You can help the site keep bringing you interesting and useful content and software by using these options:

If you like this article, please share it using the buttons below. It won't take a lot from you, but it will help us grow. Thanks for your support!


Author: Sergey Tkachenko

Sergey Tkachenko is a software developer who started Winaero back in 2011. On this blog, Sergey is writing about everything connected to Microsoft, Windows and popular software. Follow him on Telegram, Twitter, and YouTube.

Leave a Reply

Your email address will not be published.

Using Telegram? Subscribe to the blog channel!
Hello. Add your message here.