Windows Kill Process By Port Number

Do you have a running process on Windows and need to kill it by port number?

In this short tutorial, we will look at how to kill a process by port number on Windows. I am doing a lot of Java development these days and I have about 5 different applications that I may fire up during a day and because they all run on my local machine most of them use port 8080 by default. Once in a while, I will forget to kill an application. When I try and start another application I will receive this error.

Windows Port Already in use

If you need to kill a process manually on Windows it’s actually pretty easy. First, fire up a command prompt and type the following command.

netstat -a -o -n

To kill the process we need to find the PID of the process in question. I just run down the list by port until I find port 8080 and here you will see the process id was 28344.


Finally, with the PID we can run the following command to kill the process

taskkill /F /PID 28344

Windows Netstat

Pretty easy solution to a pretty simple problem. Hope this helps!

Hi, I’m Dan Vega. I am a Software Engineer living just outside of one of my favorite places in the world, Cleveland, Ohio. I am a self-taught programmer who firmly believes that you can accomplish anything in this life if you put your mind to it, roll up your sleeves and are willing to put in the work.

I have been writing software for over 18+ years now and I use my knowledge, passion, and influence to help other developers achieve their goals. I teach online and currently, have over 30,000 students.

When I am not writing software, I have a number of things that really keep me busy. I love to read books, listen to podcasts and watch online courses. I have a real thirst for knowledge and it consumes me every single day of the week. I also love to run & lift heavy weights which keep me balanced throughout the week.

Please note: I reserve the right to delete comments that are offensive or off-topic.

  • Edy B


    You can find the process listening to a specific port (such as 8080) by executing:
    netstat -ano | find “8080”

    • Matthew Quimpo

      What windows do you need to run this command?
      (sorry for the necropost)

  • Dougie T

    Thanx Man. very helpful

  • Manvendra Singh

    Thanks Dan… You are really awesome!!! 🙂

    • Praveen Kumar J V

      need some help in rendering multiple documents in react

    • Manvendra Singh

      Ok. But is it the correct thread to ask the question? Anyways, whats is the problem?

  • Ashley

    every time I try to end a task with the solution above the command prompt tells me “reason:Access is denied” Does that mean I should leave it be? Are all “Listening” ports a bad thing?

    • Try running the command prompt in administrative mode

  • Pingback: CMD Commands and usage – SelvaSantosh()

  • teja garapati

    when i execute taskkill /F /PID 2280
    it shows not found message. but in netstat command it’s showing with above process id..

    can you please resolve it

  • Ujjawal Raj

    Thanks a lot!

  • Matthew Quimpo

    I am pretty confused. I did all of the things that you told me to do, but when I did the netstat -a -o -n command, I scrolled through the numbers, but I couldn’t find the numbers I was looking for. I am trying to empty the ports 8888, 8080, or 2050. I am not very good with electronics yet, so could someone please help me?