How To Find Port Number by Process ID (PID) on Windows

It’s a pretty straightforward scenario how you find the running process’s port number when you know the process ID. Let’s say you need to find more information about a running process, the place to go is obvious – Task Manager. But Task Manager doesn’t always have all the info you are looking for. We know that you can configure to display more info by going to View > Columns … to add additional columns on other areas of the system usage, BUT not for network port numbers. There is no option to select Port Number columns from Task Manager. Instead you can do that with the old fashion with command line prompt in Windows.

Task Manager PID

If your Task Manager doesn’t have PID column showing up, this can be configured to display from View > Select Columns …

Task Manager Add Columns

Make sure PID (Process Identifier) are selected.

Task Manager show PID

Now given PID are present, you can launch command prompt by going to Start > Cmd

netstat -a -b -o

cmd PID netstat

This will list all the ports every process is listening and established. It’s going to take sometime for the command to finish, since it’s trying to return all the established connections that requires time for DNS to do reverse lookup. If you want to speed things up simply type

netstat -ano | findstr

This will display addresses and port numbers in numerical form, hence skip all the overhead. Replace <PID> to your own process ID without the <>. Ex. in my case I will use netstat -ano | findstr 18300

That’s it, a quick way to find the port number based on which process is running given you know the process ID.

Jonathan Hu

Programming by day, Web Development, Canucks & Movies for spare time!
Co-founder of Next of Windows and a cool geek 🙂

Last updated: 07/22/2015

Posted in: How to , Tips & Tricks
Discover more: , , , ,