Kill Process on Port
Type a port and get the exact command to find and kill what is using it, on Windows, Linux and macOS.
This tool builds the exact command to free a port that is already in use, the one a hung dev server or a leftover process is holding when you hit EADDRINUSE. Type the port number, pick your operating system, and it gives you both steps: the command that lists the process and its PID, and the command that ends it, plus a single line version for when you just want the port back. It covers Windows (netstat and taskkill, with a PowerShell one liner), Linux and macOS (lsof and kill), and it updates live as you change the port. Everything is generated in your browser, so it is just the right command to copy, never anything sent anywhere.
100% in your browser. Nothing you type ever leaves this page.
Find what is using the port, then end it
Freeing a port is always two moves: find the process holding it, then stop that process. The first command lists what is bound to the port and, more importantly, its PID, the process ID the system uses to address it. The second command takes that PID and ends the process. The tool above fills in your port number and gives you both, plus a single-line version for when you just want the port back. For the full walkthrough with screenshots, see the guides for Windows and for Linux and macOS.
Windows, Linux and macOS do it differently
On Windows, netstat -ano prints every connection with its owning PID in the
last column, and taskkill /PID n /F ends it; PowerShell can do both in one line
with Get-NetTCPConnection. On Linux and macOS, lsof -i :port names
the process and its PID in one step, and kill stops it. The Linux and macOS
commands are nearly identical, which is why they share a guide. The only real trap is
permissions: listing the port usually works as your normal user, but ending a process owned
by someone else needs Administrator on Windows or sudo elsewhere.
Graceful first, force second
The commands here use the forceful stop on purpose, because that is what people search for when a port will not free up. It is the right tool for a hung dev server. It is the wrong tool for a database or anything mid-write, where a clean shutdown matters more than speed. If the process is one of yours, stopping it through its own command is always tidier than a forced kill. Reach for force when something is genuinely stuck, not as the default.
Frequently asked questions
Why does it say the port is already in use (EADDRINUSE)?
Because another process is already listening on that port, and an OS lets only one process bind a TCP port at a time. Usually it is an old copy of your own server that did not shut down, a debugger, or a container still holding the port. Find its PID, confirm it is what you think, and stop it.
What is the difference between kill and kill -9?
Plain kill sends SIGTERM, a polite request to shut down that lets the process flush files and close sockets. kill -9 sends SIGKILL, which the process cannot catch or ignore, so it dies immediately and may leave temp files or a corrupt write behind. Try the graceful version first; reach for -9 only when the process refuses to exit.
Do I need administrator or sudo?
To kill a process you do not own, yes. On Windows, run the terminal as Administrator if taskkill reports access denied. On Linux and macOS, prefix the kill with sudo when the process belongs to another user or to root. Listing what holds the port often works without elevation; ending it may not.
How do I find the PID in the first place?
That is the first command this tool gives you. On Windows, netstat -ano lists every connection with its owning PID in the last column; pipe it through findstr to isolate your port. On Linux and macOS, lsof -i :port prints the process name and PID directly. Take the PID, then run the kill command with it.
Is force-killing a process safe?
For a stuck dev server or a hung script, almost always. For a database, a message broker, or anything mid-write, a forced kill can corrupt data or leave locks behind, so stop those through their own shutdown command when you can. The rule of thumb: graceful first, force only when it will not budge, and never -9 a database casually.