Windows – How to kill port at Windows?

How do you set a port free assigned to a particular process/application? This tutorial shows how to kill the port in the Windows operating system.


I got into trouble with my Spring Boot application at my development machine. My local Spring development environment could not run because the application port was occupied. By default, Spring is using port 8443. So I needed to make the port free to run my application without needing to rewrite the port number in the application config file.


Here is a simple solution on how to set the occupied port free on Windows OS:

Step 1

You must run the Windows Command Line as an Administrator or Git Bash. Then run the command below with port number in port number placeholder.

netstat -ano | findstr :MY_PORT_NUMBER

The number on the right side (PID – process identifier) is the number of processes currently using the port.

Step 2

For this, you can use only the Windows Command-Line. First, you need to kill the process using the port so the port can be set free. Type the following command with process PID to the command line:


Prefix /F, in this case, means forcefully terminates the process.

If everything went smoothly, you should get the following message:

SUCCESS: The process with PID YOUR_PID_NUMBER has been terminated.

In the end, rerun the first command to check whether or not the process is on. If you get an empty line, the process successfully ended, and the required port is free.


This article has shown how to quickly kill the Windows operating system port.

Did you find releasing ports easy? Do you have your trick, or do you know another way how to kill the port on the Windows operating system? Let us know in the comments below the article. We would like to hear your ideas and stories.

This entry was posted in Solutions and tagged , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.