How to Open, Close, and Check Open Ports in Windows
Managing ports in Windows can be essential for configuring network access and enhancing system security. This guide covers how to open and close ports, as well as how to view which ports are currently open on your computer.
How to Open a Port in Windows
- Open the Control Panel: Press Win + R, type
control
, and press Enter. - Navigate to Firewall Settings: Select “System and Security” → “Windows Firewall.”
- Access Advanced Firewall Settings: In the left panel, click “Advanced Settings.” This opens the “Windows Firewall with Advanced Security” window.
- Create a New Rule: In the right panel, select “Inbound Rules,” then click “New Rule.”
- Select the Rule Type: Choose “Port” and click “Next.”
- Specify the Port: Enter the port number you want to open, and select whether you are using TCP or UDP.
- Configure the Action: Select “Allow the connection” and click “Next.”
- Name the Rule: Enter a name for the rule to easily identify it later, and click “Finish.”
How to Close a Port in Windows
- Repeat the First Three Steps: Go to “Windows Firewall with Advanced Security” via the Control Panel.
- Locate the Rule: In the “Inbound Rules” or “Outbound Rules” section, find the rule associated with the port you want to close.
- Delete or Disable the Rule: Right-click on the rule and select “Delete” or “Disable” to close the port temporarily or permanently.
How to Check for Open Ports in Windows
To see which ports are already open on your computer, use the Command Prompt:
- Open Command Prompt: Press Win + R, type
cmd
, and press Enter. - Enter the Command to Display Ports: Type the following command and press Enter:
netstat -aon
This command displays a list of all active connections and ports with their statuses. Here’s a breakdown of the command options:
- -a — shows all active connections and listening ports.
- -o — includes the Process ID (PID), which helps identify the application using the port.
- -n — displays addresses and port numbers in numeric format, which speeds up command execution.