Find and Free Busy Ports in Windows 10/11 with netstat and PowerShell

Find and Free Busy Ports in Windows 10/11 with netstat and PowerShell​

Difficulty: Intermediate | Time Required: 15 minutes
Category: Development Tools

Introduction​

If you run development tools on Windows 10 or Windows 11, you will eventually see an error like “port already in use,” “address already in use,” or “failed to bind to port.” This commonly happens with web servers, Node.js apps, Docker containers, IIS Express, SQL tools, game servers, API emulators, and local test services.
A “busy” port means another process is already listening on that TCP or UDP port. To fix it, you need to answer two questions:
  1. Which process is using the port?
  2. Can I safely stop that process or should I change my app’s port?
This tutorial shows two reliable ways to investigate ports in Windows 10/11: the classic netstat command and modern PowerShell cmdlets.

Prerequisites​

Before starting, you need:
  1. A Windows 10 or Windows 11 PC.
  2. Command Prompt, Windows Terminal, or PowerShell.
  3. Administrator access if you need to stop a process owned by another user or system service.
  4. The port number you want to check, such as 3000, 5000, 8080, 1433, or 5432.
Note: You can run most “find” commands without elevation, but stopping processes often requires Run as administrator.

Step 1: Open Command Prompt or PowerShell​

  1. Right-click Start.
  2. Choose Terminal, Windows PowerShell, or Command Prompt.
  3. If you plan to stop a process, choose Run as administrator.
For this article, examples work in either Windows Terminal or classic Command Prompt unless labeled as PowerShell.

Step 2: Find a Busy Port with netstat​

The fastest traditional method is:
netstat -aon | findstr :8080
Replace 8080 with the port you are checking.
For example:
netstat -aon | findstr :3000
You may see output similar to this:
TCP 127.0.0.1:3000 0.0.0.0:0 LISTENING 15432
Here is what the columns mean:
  • TCP or UDP: The protocol.
  • Local Address: The local IP address and port.
  • Foreign Address: The remote endpoint, if any.
  • State: For TCP, this may show LISTENING, ESTABLISHED, TIME_WAIT, and other states.
  • PID: The process ID that owns the connection or listening port.
The important value is the final number. In the example above, the PID is 15432.

Why use -aon?​

The flags are useful together:
  • -a shows active connections and listening ports.
  • -o shows the owning process ID.
  • -n displays addresses and port numbers numerically, which is faster and avoids name lookups.
Tip: If you search for port 80, use findstr :80 carefully. It may also match ports like 8080 or 50080. Review the local address column to confirm the exact port.

Step 3: Identify the Process Name from the PID​

Once you have the PID, use tasklist:
tasklist /FI "PID eq 15432"
Example output:
Code:
Image Name                     PID Session Name        Mem Usage
========================= ======== ================ ============
node.exe                     15432 Console             85,000 K
Now you know that node.exe is using the port.
You can also use PowerShell:
Get-Process -Id 15432
For a cleaner view:
Get-Process -Id 15432 | Select-Object Id, ProcessName, Path
Note: The Path property may not always display unless your shell has enough permission to inspect that process.

Step 4: Find a Busy TCP Port with PowerShell​

PowerShell provides a more structured way to inspect TCP connections.
To check a specific port:
Get-NetTCPConnection -LocalPort 8080
To show only listening TCP ports:
Get-NetTCPConnection -LocalPort 8080 -State Listen
You will see properties such as:
Code:
LocalAddress LocalPort State  OwningProcess
------------ --------- -----  -------------
127.0.0.1    8080      Listen 15432
The key value is OwningProcess, which is the PID.
To combine the connection and process name:
Code:
Get-NetTCPConnection -LocalPort 8080 -State Listen |
ForEach-Object {
    $process = Get-Process -Id $_.OwningProcess -ErrorAction SilentlyContinue
    [PSCustomObject]@{
        LocalAddress = $_.LocalAddress
        LocalPort    = $_.LocalPort
        State        = $_.State
        PID          = $_.OwningProcess
        ProcessName  = $process.ProcessName
    }
}
This is especially handy when troubleshooting multiple developer services.

Step 5: Check UDP Ports​

Get-NetTCPConnection is for TCP only. If you need to check UDP, use:
Get-NetUDPEndpoint -LocalPort 5353
To show the owning process:
Code:
Get-NetUDPEndpoint -LocalPort 5353 |
Select-Object LocalAddress, LocalPort, OwningProcess
Then identify the process:
Get-Process -Id <PID>
Replace <PID> with the value from OwningProcess.
Tip: UDP does not have a LISTENING state like TCP. A UDP endpoint can still be bound to a local port even without a visible connection state.

Step 6: Free the Port Safely​

Once you identify the process, decide whether it is safe to stop.

Option A: Close the App Normally​

If the process is a known application, close it first. Examples:
  1. Stop the development server with Ctrl+C in its terminal.
  2. Close the app window.
  3. Stop the service from its own dashboard, such as Docker Desktop or a database tool.
This is the safest option.

Option B: Stop the Process with PowerShell​

If you are sure the process can be stopped, run:
Stop-Process -Id 15432 -Confirm
PowerShell will ask for confirmation before stopping it.
If you need to force it:
Stop-Process -Id 15432 -Force
Warning: Be careful with -Force. Stopping the wrong process can close apps, interrupt services, break active work, or destabilize Windows components.

Option C: Stop the Process with taskkill​

From Command Prompt:
taskkill /PID 15432
If it refuses to stop:
taskkill /PID 15432 /F
The /F switch forces termination.

Step 7: Confirm the Port Is Free​

After stopping the process, check again:
netstat -aon | findstr :8080
Or with PowerShell:
Get-NetTCPConnection -LocalPort 8080 -ErrorAction SilentlyContinue
If no matching listener appears, the port is free.
You can now restart your application.

Tips and Troubleshooting Notes​

If the Port Still Appears Busy​

Wait a few seconds and check again. TCP connections can briefly remain in states such as TIME_WAIT after an app closes. Usually this clears on its own.

If the PID Belongs to a Service​

Some ports are owned by Windows services, database engines, virtualization software, web servers, or security tools. Instead of killing the process, open Services:
  1. Press Win + R.
  2. Type:
services.msc
  1. Locate the service.
  2. Stop or restart it only if you understand what it does.

If You Keep Hitting the Same Conflict​

Consider changing your application’s port. For example, if port 3000 is busy, configure your dev server to use 3001 or 5173.

Common Developer Ports to Check​

  • 80 and 443: Web servers
  • 3000, 5173, 8080: Web development servers
  • 5000, 5001: .NET or API development
  • 1433: SQL Server
  • 3306: MySQL/MariaDB
  • 5432: PostgreSQL
  • 6379: Redis
  • 27017: MongoDB

Conclusion​

Finding and freeing busy ports is an essential Windows troubleshooting skill for developers and power users. netstat is quick, reliable, and available everywhere. PowerShell gives you richer, object-based output that is easier to filter, format, and script.
Use the PID to identify the owning process, stop it safely when appropriate, and always double-check before forcing a process to close.
Key Takeaways:
  • Use netstat -aon | findstr :PORT to quickly find what is using a port.
  • Use Get-NetTCPConnection -LocalPort PORT for a PowerShell-friendly TCP view.
  • Match the PID to a process with tasklist or Get-Process.
  • Stop processes carefully with Stop-Process, taskkill, or the app’s own shutdown method.
  • If the process is important, change your app’s port instead of killing the process.

This tutorial was generated to help WindowsForum.com users get the most out of their Windows experience.
 

Back
Top