How to check open ports windows

Certain apps and processes in Windows 10 can cause problems if you’re not properly connected to the internet. Firewalls can cause these connection issues when they cannot determine whether incoming and outgoing connections pose a threat. Work around this issue and open ports for incoming and outgoing connections. We will know to check whether a TCP port is open or closed on the Windows operating system.

Basically, many times we need to check the port status when any of the below issues results in closing the port.

  1. They may not be properly working.
  2. External IP addresses that are in use may be set to private IPs.
  3. Firewall rules may block the network.

There are several ways to check open TCP/IP ports in Windows. Here are a few options:

Using Telnet Client:

Step 1: Check whether the telnet client feature is ON or not. In order to check, open the Turn Windows feature on or off settings from the search bar. OR press the ‘window’ key and type ‘windows’ features. Then press on “Turn Windows features on or off”.

Windows Features Option

A new prompt will be opened. Search for “Telnet Client” and check the box in front of ‘telnet Client’.

Windows Features

Step 2: Open the command prompt. Press the ‘windows’ key and type ‘cmd’. Press “Command Prompt”.

Command Prompt Option

Step 3: On the command prompt, type the command “telnet + IP address or hostname + port number” and check the status of the provided TCP port.

Telnet Command

Step 4: If only the blinking cursor is visible, then the port is open.

Port is Open

Step 5: If you get the message “connection failed” then the port is closed.

Port is close

Using built-in netstat command-line utility:

Step 1: Open the command prompt. 

Step 2: Run the following command:

netstat -an

Using TcpView

Another option is to use the TcpView utility from Microsoft’s Sysinternals suite of tools. This utility provides a more user-friendly interface for viewing active TCP/IP connections, along with additional information such as the process ID and process name for each connection. Steps to be followed:

Step 1: Download the TcpView utility from the Microsoft Sysinternals website. You can find the download link on the TcpView page of the Sysinternals website.

Download Page

Step 2: Extract the downloaded file and run the TcpView.exe file to launch the TcpView utility. This will open the TcpView window, which shows a list of all active TCP/IP connections on your machine.

Extracted FIles

Step 3: Open the tcpview.exe (application).

By default, TcpView will display the following columns in the list of connections:

Protocol: Shows the protocol being used for the connection (TCP or UDP)

Local Address: Shows the local address and port being used for the connection

Remote Address: Shows the remote address and port being connected to

State: Shows the current state of the connection (e.g. Established, Listen, etc.)

You can use the “Local Address” and “Remote Address” columns to see which ports are being used by which applications. For example, if you see a connection with a local address of “127.0.0.1:80”, this means that the local application is using port 80 for outgoing connections.

Windows PowerShell

You can also use Windows PowerShell to check open TCP/IP ports. To do this, use the Get-NetTCPConnection cmdlet, which allows you to view a list of active TCP/IP connections and the local and remote addresses and ports being used. For example, you can run the following command to view a list of all active TCP/IP connections:

Get-NetTCPConnection | 
Select-Object LocalAddress,
LocalPort, RemoteAddress, RemotePort

Get-NetTCPConnection cmdlet

Nmap

To install Nmap in the Windows command line, follow these steps:

Step 1: Download the latest version of Nmap from the Nmap website. You can find the download link on the Nmap download page: 

https://nmap.org/download.html

Step 2: Extract the downloaded file to a location on your computer. This will create a new folder containing the Nmap files.

Step 3: Open a command prompt and navigate to the directory where you extracted the Nmap files. For example, if you extracted the files to the C:\nmap directory, you would run the following command:

cd C:\nmap

Step 4: Once you are in the Nmap directory, you can install Nmap by running the nmap.exe file. To do this, run the following command:

nmap.exe -V

This will display the version number of Nmap, indicating that it has been installed successfully.

Step 5: To use nmap to scan for open TCP/IP ports, run the “nmap -sT” command, followed by the IP address or hostname of the machine you want to scan.

nmap -sT localhost

This will scan the specified host or IP address and display the results. You can also use the -h option to view a list of available options and arguments for the nmap command. Overall, installing Nmap in the Windows command line is a straightforward process. You can download the latest version of Nmap from the Nmap website, extract the files, and then run the nmap.exe file to install it. Once it is installed, you can use the nmap command to scan hosts and IP addresses and view the results.

Last Updated :
01 Jan, 2023

Like Article

Save Article

A port in networking world refers to a logical gateway on your computer that acts as a communication channel for remote computers for services. Your computer connects to any server/computer on the same network or the internet via a port.

There are numerous ports on your computer, but not all of them are open. Those ports connected to any incoming remote IP address and capable of exchanging data packets are called open ports. Such open ports can be abused to penetrate your computer if not monitored properly. 

Some methods to check and monitor open ports on your computer have been addressed in this article.

Table of Contents

Windows provides its users with various inbuilt tools to detail information related to networking in a computer. The tools that will help to check open ports on your computer are Netstat, Get-NetTCPConnection, and Telnet. The steps for each have been listed below:

Netstat

Netstat (Network Statistics) is a command line tool in Windows that is able to provide various details related to the network connections of your computer. By running the right command on your Command prompt, you will be able to check for open ports. The steps for this include the following:

  1. Press Windows + R keys to open Run.
  2. Type cmd and hit Ctrl + Shift + Enter to open Elevated Command Prompt.
    cmd-from-run
  3. Click on the Yes button to provide Admin privileges.
  4. Run the command: Netstat -na
    netstat-in-cmd-min

Here, switch ‘n’ would show the IP address and ports numerically. And the ‘a’ switch filters to show only active ports. 

Referring to the above image, the numbers beyond the colon on both local and foreign addresses show the port number and, before the colon are the IPs.

For instance, Local address 0.0.0.0:135 is in Listening state for TCP protocols, which means port number 135 on your computer is open and ready to connect from all networks. 

Except, foreign address shows the IP address:port number of the remote system where the connection has been established.

Get-NetTCPConnection

An alternative to the netstat command in Command Prompt would be Get-NetTCPConnection in Powershell. The availability of filtering features in Powershell provides an upper hand, as it can provide a list of only open ports. The steps mentioned below will guide you in doing so:

  1. Press Windows + R to open Run.
  2. Type Powershell and open it with Admin privileges as above.
    powershell-from-run
  3. Run the command: Get-NetTCPConnection -State Listen | Select Local*, State | sort LocalPort
    powershell-check-ports-min
  4. You can view the port number in the LocalPort column and the corresponding IP address in the LocalAddress column.

TCPView

TCPView is a free tool from Microsoft Sysinternals to get network statistics in an interactive GUI(graphical user interface) form. You will be able to view the open ports on your computer as soon as you download and launch the application. Follow the steps to do so:

  1. Download the TCPView zip file from their website.
  2. Right-click on the zip file and select Extract All…
    extract-tcpview
  3. Click the Browse… button, choose the desired address, and hit Extract.
  4. Now, open the extracted folder and double-click on tcpview.exe
    tcpview.exe
  5. Click on Run and then Yes.
  6. Yet again, you can view open ports on the Local Port column corresponding to Listen status in the State column.
    tcpview

Telnet

Telnet is a Microsoft service that uses a virtual terminal to connect to computers within the same network. Upon running its command, telnet tries to connect to any specified port of the mentioned IP address (computer). If the port is open on that IP, the connection establishes, and if it isn’t, the connection fails.

Note: It is only useful if you want to check the state of desired ports on a remote computer.

You can follow the steps below to do so:

  1. Press the Windows logo key to initiate the Windows search.
  2. Type Turn Windows features on or off and hit Enter.
    Turn-windows-features-on-or-off
  3. Scroll to Telnet and check the box for it.
    check-telnet-client
  4. Now, open Command Prompt with Admin privileges.
  5. Run the command: telnet <IP address of your remote computer> <port number>
    telnet-command
  6. When running this command, the port is open if the screen clears and connection is setup. But you can know that the port is closed if it returns an error message as connect failed

Should I Close All the Open Ports?

Seeing so many open ports on the computer can be overwhelming for a user. However, if you have checked your ports through the netstat command, you can get more information about what type of open ports and established connections are safe.

As already covered, the local address (IP:port_number) shows to which IPs (network IPs) the computer is open and at which specific port. If the IP addresses start with 127.#.#.#, the corresponding port is open to only loopback addresses meaning local hosts(your own computer). No need to worry about threats there.

ip information

But 0.0.0.0 IPs mean the suffixed ports are open to any type of connection, so they may be at potential risk but not at the current moment. Ports Listening to the local network IPs might be at slightly lower risks. However, other ports having Established connections should be kept an eye on. 

Peculiar local addresses/ports connected to unknown foreign IP addresses/ports might be risky. But before you rush to close all the open ports, just know that not all the open ports are at a security risk.

If you’re worried about any specific port, we recommend checking your firewall rules to understand what it’s used for before closing it.

How to Close an Open Port on Windows?

If you find a port connected to any unwanted computer/server/service, you can disconnect the connection and free up the port by using the Process ID(PID). PID associated with any port can be viewed with netstat -aon a command on the Command Prompt. The Process ID would list on the PID column of the returned tabular result.

Now, to free up the port, you run the command: taskkill /f /im <PID> 

taskkill block

But, if you want to completely block incoming connections to any desired port using Windows Firewall, you can run the following command in Command Prompt:

netsh advfirewall firewall add rule name= "<any>" dir=in action=block protocol=TCP localport=<port number>

You can change the <any> to any rule name you want and <port number> to the actual port number you want to block incoming connections to. 

netsh block port

Furthermore, to open the blocked port, you can edit the action as allow (action=allow)in the command. And you can also edit dir as out, (dir=out), to perform an action on outgoing connections. Also, you can toggle between TCP and UDP protocols by changing protocol=UDP

30

30 people found this article helpful

You can use a Windows command or third-party utilities

What to Know

  • Easiest: Open the Start menu > type command > right-click the Command Prompt app > Run as administrator.
  • Type netstat -ab > press Enter > look for items in the «LISTENING» state. 
  • The alternative is to use a third-party app: We like TCPView, Nirsoft CurrPorts, and PortQry Command Line Port Scanner.

This article outlines how to check for open ports in Windows 10, which is necessary if an application cannot access the internet or you want to block an application.

How to Check If a Port Is Open With Netstat

The easiest way to check if a port is open on Windows 10 is by using the Netstat command. ‘Netstat’ is short for network statistics. It will show you what ports each internet protocol (like TCP, FTP, etc.) is currently using.

The command has many parameters, but the ones you’ll need to use to check if a port is open are (a), which provides the active ports, and (b), which will tell you the name of the processes using those ports.

  1. Select the Start menu and type «command.» Right-click on the Command Prompt app and select Run as administrator.

  2. Type netstat -ab and press Enter. You’ll see a long list of results, depending on what’s currently connecting to the network. You’ll see a list of running processes. The open port numbers will be after the last colon on the local IP address (the one on the left).

  3. Look for the items on the list with a state of «LISTENING.» These are the processes that are communicating via one of the currently opened ports.

  4. If you want to know the program’s name that has a specific port open, then type netstat -aon and press Enter. This command will show the protocol the app is using, the local and remote IP addresses, and most importantly, the PID of the application using that port (the number on the far right). Remember to look for the LISTENING status.

  5. To find the application related to that PID, right-click the task manager and select Task Manager. Select the Details tab. Look in the PID field for the PID you noted from the command prompt screen.

How to Check If a Port Is Working Using Third-Party Apps

If you don’t want to use the command prompt to check for open ports, there are very easy-to-use third-party apps that can help.

TCPView

TCPView is a utility included in Microsoft Sysinternals that shows you a list of all running processes and their associated open ports. This app displays ports opening and closing and packet transfers, all in real-time.

Nirsoft CurrPorts

Nirsoft CurrPorts is another utility to see all ports currently being used by applications and services on your system. Just look for the local ports column to see which of your computer’s ports are active.

The list also includes ports that are being connected to on the remote end (the server out on the internet).

PortQry Command Line Port Scanner 

Install PortQry Command Line Port Scanner for another command-line utility dedicated to scanning your computer for open ports. Once you install it, open Command Prompt in administrator mode. PortQry automatically installs in the C:\PortQryV2 directory, so change the directory of your command prompt to that directory.

Type the command portqry.exe -local to see all open TCP and UDP ports for your machine. It’ll show you everything you can see with the NetStat command, plus port mappings and how many ports are in each state.

What Is a Port?

Applications running on your computer reach out and get information and data from servers elsewhere on the internet. These applications and the server know how to communicate based on their IP address and the port number.

Think of the IP address as a street address and the port number as the apartment number. If either the server or application attempts to communicate using any other port number, it won’t work. Every other door will be «locked» because other ports are closed.

Thanks for letting us know!

Get the Latest Tech News Delivered Every Day

Subscribe

If you’re checking from the outside, not from the server itself, and you don’t want to bother installing telnet (as it doesn’t come with the last versions of Windows) or any other software, then you have native PowerShell:

Test-NetConnection -Port 800 -ComputerName 192.168.0.1 -InformationLevel Detailed

(Unfortunately this only works with PowerShell 4.0 or newer. To check your PowerShell version, type $PSVersionTable.)

PS: Note, these days there are some claims on the twittersphere that hint that this answer could be improved by mentioning «Test-Connection» from PowerShell Core, or the shortcut «tnc». See https://twitter.com/david_obrien/status/1214082339203993600 and help me edit this answer to improve it please!


(If you have a PSVersion < 4.0, you’re out of luck. Check this table:

Enter image description here

Even though you can upgrade your version of PowerShell by installing the Windows Management Framework 4.0, it didn’t do the trick for me, Test-NetConnection cmdlet is still not available).


Download Article


Download Article

Are you looking for a quick way to check if a port on your router or firewall is open? It’s actually pretty simple. The right way to do it just depends on whether you’re using a Mac or PC and what kind of port you’re checking. We’ll walk you through how to do it step-by-step on Windows and macOS.

  1. Image titled Check if a Port Is Opened Step 12

    1

    Enable Telnet for Windows. You can use Telnet to check if a certain port is open on your local router or access point. Here’s how to enable it:[1]

    • Type windows features in to the search bar. If you don’t see the search bar, click the circle or magnifying glass to the right of the Start menu.
    • Click Turn Windows features on or off.
    • Check the box next to Telnet Client and click OK.
    • Click Close when the app is finished installing.
  2. 2

    Open a command prompt. Here’s how to open the command prompt:

    • Type cmd into the Windows search bar.
    • Click Command prompt in the search results.

    Advertisement

  3. Image titled Check if a Port Is Opened Step 14

    3

    Type ipconfig at the prompt and press Enter. This displays a bunch of network information.

  4. Image titled Check if a Port Is Opened Step 15

    4

    Write down the router’s IP address. The address that appears next to «Default Gateway» in the ipconfig results is the local address of your router.

  5. Image titled Check if a Port Is Opened Step 16

    5

    Type telnet at the prompt and press Enter. This opens the Microsoft Telnet prompt.

  6. Image titled Check if a Port Is Opened Step 17

    6

    Type open (router's IP address) (port number). For example, if you wanted to see if port 25 is open on your router, and your router’s IP address is 10.0.0.1, you would type open 10.0.0.1 25.

  7. 7

    Press Enter. Telnet will try to connect to the port.

    • If you see a message that says «Please press Enter» or «Press any key to continue,» the port is open.
    • If you see a message that says «Could not open connection,» the port is not open.
  8. Advertisement

  1. 1

    Open a Terminal window. To open a Terminal window, open Spotlight by clicking the magnifying glass at the top-right corner of the screen, type terminal, and then click Terminal in the search results.

    • Use this method to see if a port is open on your local router or access point.
  2. Image titled Check if a Port Is Opened Step 20

    2

    Type netstat -nr | grep default at the prompt and press Return. The router’s IP address appears next to «default» at the top of the results.

  3. Image titled Check if a Port Is Opened Step 21

    3

    Type nc -vz (your router's IP address) (port). For example, if you wanted to see if port 25 is open on your router, and your router’s IP address is 10.0.0.1, you would type nc -vz 10.0.0.1 25.

  4. Image titled Check if a Port Is Opened Step 22

    4

    Press Return. Here’s how to interpret the results:

    • If the port is open, you’ll see a message that says the connection succeeded.
    • If the port is closed, you’ll see a message that says the connection was refused or timed out.
  5. Advertisement

  1. 1

    Open Windows search and type firewall. If the search bar is not already open, click the circle or magnifying glass to the right of the Start menu to open it.[2]

    • Use this method if you want to see if Windows is set up to allow an app you’ve installed to communicate through your firewall.
    • The Windows firewall is enabled by default. If you’ve installed your own firewall software, use that software to check if an app is allowed through.
  2. Image titled Check if a Port Is Opened Step 5

    2

    Click Windows Defender Firewall. This opens your Firewall and Network Protection settings.

  3. Image titled Check if a Port Is Opened Step 6

    3

    Click Allow an app through firewall. It’s one of the text links near the bottom of the window. A list of apps allowed through the firewall will appear.

    • If the app is allowed through the firewall only when you’re connected to a network you’ve marked as «private» (such as when you’re on your home network), a check will appear in the «Private» column next to the app.
    • If the app is allowed through the firewall when you’re connected to a public network, a check will appear in the «Public» column.
  4. 4

    Allow an unlisted app or port through the firewall. If you don’t see the app on the «Allowed apps and features» list, click the Change Settings button at the top-right corner, and then follow these steps:[3]

    • Click Allow another app near the bottom.
    • Click Browse, select the app, and then click Open.
    • Click Network Types near the bottom-left corner, select a privacy preference, and then click OK.
    • Click Add to add the app, and then click OK.
  5. Advertisement

  1. Image titled Check if a Port Is Opened Step 1

    1

    Go to http://www.canyouseeme.org in a web browser. You can use it to see if a port on your computer or network is accessible on the internet. The website will automatically detect your IP address and display it in the «Your IP» box.[4]

    • There are many different sites you can use to check for an open port. Search for «open port check tool» in your favorite search engine to find an alternative, if desired.[5]
  2. 2

    Enter the port. Type the port you want to check (e.g., 22 for SSH) into the «Port to Check» box.[6]

  3. 3

    Click Check Port. If the port is open and available, you’ll see a confirmation message. If not, you’ll see a message that says «Error: I could not see your service on (your IP address) on port (the port number).»[7]

  4. Advertisement

  1. Image titled Check if a Port Is Opened Step 8

    1

    Click the

    Mac Apple

    menu and select System Preferences. The Mac firewall is not enabled by default.[8]

  2. Image titled Check if a Port Is Opened Step 9

    2

    Click Security & Privacy. It’s the house icon on the top row.

  3. 3

    Click the Firewall tab. It’s near the top-center part of the window.

    • If you see the message «Firewall:On» near the top of the tab, this means your firewall is active.
    • If the firewall is not active but you want it to be, click the padlock icon at the bottom-left part of the window, enter your administrator password, and then click Turn On Firewall.
  4. 4

    Click Firewall Options. This opens your settings, including a list of apps and services set to either allow or disallow incoming connections.[9]

    • If an app or service has a green dot and the text «Allow incoming connections,» that means its port is open.
    • If you see a red dot that says «Block incoming connections,» the port is closed.
    • You can toggle whether a port is allowed or not allowed by clicking the double-arrow icon next to the app’s current status, and choosing an option.
  5. Advertisement

Add New Question

  • Question

    How do I check if a port is open Windows 10?

    Luigi Oppido

    Luigi Oppido is the Owner and Operator of Pleasure Point Computers in Santa Cruz, California. Luigi has over 25 years of experience in general computer repair, data recovery, virus removal, and upgrades. He is also the host of the Computer Man Show! broadcasted on KSQD covering central California for over two years.

    Luigi Oppido

    Computer & Tech Specialist

    Expert Answer

    An easy way to do this is to go to canyouseeme.org and type in the port number into the webpage. It’ll be able to tell you whether or not the port is open.

Ask a Question

200 characters left

Include your email address to get a message when this question is answered.

Submit

Advertisement

About This Article

Thanks to all authors for creating a page that has been read 607,676 times.

Is this article up to date?

  • How to change start button in windows
  • How to connect airpods to windows
  • How to delete second windows
  • How to check gpu on windows 10
  • How to change python version windows