If you are using an application that needs to connect to the internet, like an online game, WhatsApp, etc., then it is definitely using and listening on a specific network port. Network ports are used by services and apps to send and receive data over the network.
Like an IP address guides traffic between different devices over the internet, a port defines which application or service the data is intended for, once it reaches (or leaves) a device.
There can be occasions when a network admin or even a simple user would need to know which port or ports are being used by a specific application or vice versa.
As a gamer, there are instances when you must use port forwarding on your router to reduce latency between the game and its servers. But that cannot be done without knowing which port it is using. This is where we come in.
In this guide, we will discuss how you can determine which port(s) are being used by an application on a Windows computer, or which app is using a specific port.
Table of contents
How to Check Which Port is Used by an App
First, we will show you how to check which port is being used by a specific application. For this, you must know the Process ID (PID) for the process running behind the application.
Follow these steps to check which port is being used by an application on a Windows computer:
First, we must find the PID for the process for the app for which you wish to find the listening port. For that, run the application, minimize it, and then open the Task Manager using the Ctrl + Shift + Esc shortcut keys.
In the Processes tab, expand the app processes by clicking on it, right-click on the app and then click Go to details from the context menu.
You will now be taken to the Details tab where the file name and its details for the associated process will be highlighted. Note down its PID which is in the second column from the left.
Now that you have the PID, run an elevated Command Prompt instance and use the following cmdlet to find its listening port. Replace [PID] with the Process ID noted in Step 3 above.
Note: You can also find the port number using the file name running the process. However, in that case, you would need to use the exact name of the file which is also case-sensitive. Therefore, we do not recommend that method since a single typo would make the result unobtainable.
netstat -aon | findstr [PID]
In the last step above, you will have the details for the specific PID where you can see its local IP address followed by the port number being used (denoted after the colon), remote IP address and port number, connection state, and its PID (in that order – left to right).
From this, you shall have which port the application is using.
If it is using more than one port, then you will see multiple entry rows. However, if you enter an incorrect PID or the app is not using an internet connection, then you have no results after running the command above.
How to Check Which App is using a Specific Port
If you already know that your PC is listening on a specific port but want to know which app or service is using it, that can also be done. Here is how:
Run the following cmdlet in an elevated Command Prompt while replacing [PortNumber] with the port number that you already know is listening.
netstat -aon | findstr [PortNumber]
This will now give you different details about the app and its process, except for the name of the app. However, you will get the associated Process ID (PID), which is in the last column. Note down this PID.
Now, use the following cmdlet while replacing [PID] with the PID noted in the step above.
tasklist | findstr [PID]
As you can see in the image above, you will now have the name of the file running the process for that application, using which you now know which application is listening on that specific port.
If at any point in the process you did not get a result after running a cmdlet, then it is likely that you entered an incorrect port number or PID.
Moreover, an app can listen on multiple ports simultaneously, so do not be confused if you get multiple results.
Port mapping can significantly improve your internet speed and reduce latency. But for that, you must know which port or ports you want to configure for maximum throughput. On a Windows PC, this is the way to go to find out which app is using which port, and vice versa.
Once you know which ports are being used by which apps, you can now configure them on your router. Or, you may close an open port by terminating its respective process/app.