How to Check Open Ports Locally on Windows, macOS, and Linux
Local listening ports vs. internet-reachable ports — and how to inspect both
Checking whether a port is listening on your own machine is a different question from checking whether it is reachable from the internet. A service can be listening locally while still being invisible externally, because of a router, firewall, or NAT layer in between. This guide covers the local side; use PortCheck for the external side once you've confirmed the service is actually running.
Windows: netstat and PowerShell
Open Command Prompt and run:
netstat -ano | findstr :PORT
This lists any process with an open connection or listening socket on that port, along with a process ID (PID) in the last column. To find which application that PID belongs to, run tasklist | findstr PID, or use the more modern PowerShell equivalent:
Get-NetTCPConnection -LocalPort PORT
macOS: lsof
macOS uses the same BSD-derived tools as many Unix systems. Open Terminal and run:
sudo lsof -i :PORT
This shows the process name, PID, and connection state for anything bound to that port. If nothing is printed, no process on the machine is listening on that port.
Linux: ss and lsof
Most modern Linux distributions favour ss over the older netstat:
sudo ss -tlnp | grep :PORT
The flags mean: -t (TCP), -l (listening sockets only), -n (numeric addresses/ports instead of resolving names), and -p (show the owning process — may require sudo). lsof -i :PORT works identically to the macOS example above on most distributions with lsof installed.
Interpreting the Bind Address
Pay close attention to the local address column in the output. A service bound to 127.0.0.1 or localhost only accepts connections from the same machine and will never be reachable externally, no matter what your router or firewall allows. A service bound to 0.0.0.0 (or a specific LAN address) accepts connections from other machines on the network, which is a prerequisite — though not a guarantee — for it to be reachable from the internet.
Next Step: Confirm External Reachability
Once you have confirmed a service is listening on the correct address and port locally, the remaining question is whether your router, ISP, and any cloud firewall rules allow the connection through from outside. Run a check on PortCheck, and if the port doesn't appear open, work through our troubleshooting checklist.