How to kill a process currently using a port on localhost in Windows

Open up the cmd.exe and run it as an administrator.

Step 1

Then run the below command

netstat -ano | findstr :<PORT>

Example- You can replace the <PORT> with the port number you want

Step 2

Now, run the following command to kill the process using process ID.

taskkill /PID <PID> /F

Example- Now you can replace the <PID>

(Now I have successfully killed the process with PID 4888 which was running on port 8080)

Step 3

If you want you can check whether the process was successfully killed or not by running the command in step 1. If it was then you cannot see the killed process ID.

--

--

Sachini Dissanayaka

Software Engineer | Computer Science & Engineering graduate at University of Moratuwa