Logo 15punkte.com
Nov. 22
4 Min

How to kill a process that is currently using a port on localhost in windows?

To kill a process that is currently using a port on localhost in Windows, you can follow the steps in this article.

What is a process?

In the context of computers, a process is a program or set of instructions that are being executed by the central processing unit (CPU). When a program is launched, the operating system creates a process for it and assigns it a unique process ID (PID). The process then begins to execute, using the CPU and memory resources of the computer.

A process can have multiple threads, which are smaller units of execution within the process. Threads allow a process to perform multiple tasks concurrently, and are useful for improving the performance of the process.

A process can be in one of several states, including running, waiting, or terminated. The operating system is responsible for managing the processes on a computer and allocating resources to them.

In general, processes are an important part of how a computer operates, as they allow the CPU to execute a wide range of tasks and programs.

What is a port?

In the context of computers, a port is a communication endpoint that is used to send and receive data over a network. It is a logical connection point for a specific type of network service, and is identified by a unique number called the port number.

Ports are used to allow different network services, such as web servers or email servers, to coexist on the same computer. Each service is assigned a unique port number, so that the operating system can distinguish between different services and route incoming data to the correct service.

For example, the HTTP protocol, which is used to transfer web pages, uses port 80 by default. This means that when a client computer sends a request for a web page to a server, it sends the request to port 80 on the server. The server then responds with the requested web page, which is sent back to the client through port 80.

In general, ports are an important part of how computers communicate over networks and are used to allow multiple services to run on the same computer or network.

How to kill a process?

To kill a process, you can use the "taskkill" command in the Command Prompt on Windows or the "kill" command in the Terminal on macOS or Linux. Follow the steps below.

Step 1: Open your terminal as administrator

Click on the search button in your taskbar and search for cmd. You should see the terminal / commandline tool in the results. Right click on the tool and choose „Open as administrator“.


Step 2: Find the service that is blocking your port

To find out the service / program that is blcoking your port type the following into your terminal window

netstat -ano | findstr :portNr

There portNr is the port that you are searching, e.g. 8080

You should now see a result list. If a service is blcoking your port the netstat command should show you the processId (PID). The processId is the number in the last column. For example 3400


Step 3: Kill the process that is blocking your port

Now its time to kill the process / service that is blocking your port. To do this type the following command into your terminal.

taskkill /PID <PID> /F

So in our example we would type

taskkill /PID 3400/F
taskkill success

Step 4: Check if the process no longer block your port

To check if the process is really no longer blocking your port, you can call the netstat command again. The output should look like this.



  1. Open the Command Prompt. You can do this by typing "cmd" in the search bar and pressing Enter.
  2. In the Command Prompt, type the following command: netstat -ano | findstr :<port number>

Replace <port number> with the actual port number that you want to check. This command will show a list of all processes using the specified port.

  1. To kill a process using the port, you need to know the process ID (PID). Look for the PID in the second column of the list.
  2. Once you have the PID, type the following command: taskkill /F /PID <PID>

Replace <PID> with the actual process ID of the process you want to kill. The /F option forces the process to terminate, and the /PID option specifies the process ID.

  1. Press Enter to execute the command. The process should now be terminated.

It is important to note that killing a process can cause problems or data loss if the process is performing an important task. Use this method with caution and only if you are sure that the process is not needed.


Wenn du uns unterstützen möchtest, würden wir uns über einer Spende sehr freuen. Dies hilft uns, auch zukünftig guten Content bereitstellen zu können.
*Bei einem Klick auf Links, die mit einem Stern gekennzeichnet sind, erhalten wir im Falle eines Kaufs eine kleine Provision. Für dich entstehen keine Mehrkosten. Durch die Provision können wir dir auch in Zukunft guten Content erstellen. Vielen Dank! ❤️