To identify which process is using a specific TCP or UDP port on Windows, follow these steps using built-in tools:
Method 1: Command Prompt/PowerShell (Built-in Tools)
- List all ports and their associated PIDs:
netstat -ano
-a
: Displays all connections and listening ports.-n
: Shows addresses and ports numerically.-o
: Includes the Process ID (PID).
- Filter for your specific port (e.g., port
80
):
netstat -ano | findstr ":80"
- Replace
80
with your port number. - Look for the PID in the last column.
- Find the process name from the PID:
tasklist /FI "PID eq 1234"
- Replace
1234
with the PID from the previous step. In PowerShell:
Get-Process -Id 1234
Method 2: Resource Monitor (GUI)
- Press
Win + R
, typeresmon
, and hit Enter. - Go to the Network tab.
- Under Listening Ports, sort by Port to find your port and its associated process.
Method 3: Sysinternals TCPView (Third-Party Tool)
- Download TCPView from Microsoft.
- Run
Tcpview.exe
(no installation required). - Locate your port in the list, which shows:
- Process name
- Protocol (TCP/UDP)
- Local/remote addresses
- Status
Example Workflow
Check port 8080
:
- Find the PID:
netstat -ano | findstr ":8080"
Output:
TCP 0.0.0.0:8080 0.0.0.0:0 LISTENING 1234
- Identify the process:
tasklist /FI "PID eq 1234"
Output:
Image Name PID Session Name Session# Mem Usage
========================= ======== ================ =========== ============
node.exe 1234 Console 1 250,000 K
Key Notes
- Run as Administrator: Ensure Command Prompt/PowerShell has elevated privileges to see all processes.
- UDP Ports: Use the same steps for UDP ports (look for
UDP
in theProto
column). - Persistent Port Issues: Use
TCPView
to monitor ports in real-time.