Every process that is run on Windows uses a different port. So, suppose you’re trying to run an application that needs to utilize a particular port that is already in use. In that case, you may end up receiving an error message that goes something like – “Port 8080 is being used” or “The port number you provided is already in use.”
The only way to get around this error is to manually kill the process that is occupying said port currently. The article below shows how you can identify which port is being used by which process and the different methods that will let you kill it so you can free up that port.
How to find if a port is in use (and its associated process)
First up, open Command Prompt. Press Start, type cmd, right-click on ‘Command Prompt’, and select Run as administrator.
Type the following command to get a list of all the ports in use.
You will now get a list of all the active ports on your system. The last few digits of an address (after the last colon) make up a port number. While its corresponding PID is the unique ID number of the process that is linked to it.
To find if a specific port is in use, type the following command:
netstat -ano | findstr :port-number
Replace “port-number” with the actual port number and press Enter.
If it is in use, you will see a PID on the right, along with the words Listening or Established.
To find the process, open Task Manager by pressing Ctrl+Shitf+Esc. Then look for the process with that PID.
If you don’t see the PID column, right-click on one of the columns and select PID.
Alternatively, you can make use of Resource Monitor to find the process. Press Start, type resource monitor and open it.
Expand Network and look for the process with the PID.
How to Kill a Process on Port
Here are a few ways that will allow you to identify which process is using which port and how to kill it.
Method #1: Via Command Prompt
Once Command Prompt (as shown earlier) and type the following command:
To free up a port and kill the process associated with it, type in the following command:
taskkill /PID <type PID here> /f
Then press Enter. You should now get a message saying that the process has been terminated.
This method is the most commonly used method to find and kill processes that are on contentious ports such as port 8080 or 3000 which multiple processes and programs might want to access.
Method #2: Via PowerShell
Terminating the process associated with the port can also be done via PowerShell. This is how:
Press Start, type Powershell, right-click on the result, and click on Run as administrator.
Similarly to the Command Prompt, type the following command in PowerShell:
Then Press Enter. You will get a list of all active connections.
Once you have the port, and its corresponding PID, you can know which process is linked to it (shown earlier). Take note of the PID that is using up a specific port.
To kill the process, type the following command:
taskkill /PID <enter PID here> /f
Press Enter. You will now get a message telling you that the process has been terminated.
Method #3: Via Task Manager
This method works only if you know the PID that is linked to the port, for which purpose you will invariably have to go to refer to the command prompt or Powershell. But once you find the port and the PID associated with it, you can also end its associated process via Task Manager. Here’s how to do so.
Press Ctrl+Shift+Esc to open up Task Manager. Here, if you don’t already see a PID tab, right-click on one of the tabs and select PID.
Now find the process that is associated with the PID that you want to kill. Right-click on the process and select End Task.
That’s it. You have now freed up the port that was linked to that process/PID.
Method #4: Via CurrPorts (Third Party Software)
There are a few third-party apps that let you kill a process that is associated with a port with just a click. One of them is CurrPorts, a free software that gets the job done in a jiffy.
On the aforementioned link, scroll down and click on Download CurrPorts.Once the file is downloaded, extract its contents and then run the cports.exe file.
The main page of CurrPorts will provide you with all the information related to a given process, including its PID and the port being utilized. Simply right-click the process that you want to kill and select Kill Processes of Selected Ports.
Your port is now free.
Though third-party applications abound, the Command Prompt and PowerShell are still one of the most used methods to kill a process on a port as they help to both identify and execute the process without any extraneous downloads. We hope the methods provided above allowed you to kill the processes on any given port on Windows 11.