How to Check Open Listening Ports on Windows, Linux, & macOS
Before setting up router port forwarding or debugging external connectivity, you must confirm your service is actively bound to the socket and listening on the wildcard interface. Here is how to find open ports across all major operating systems.
The #1 Port Forwarding Mistake: Localhost vs Wildcard Binding
When an external port test fails with CLOSED (ECONNREFUSED), over 80% of the time the issue is not the router—it is the application's local IP binding:
Accepts packets originating strictly from the local computer. Any packet forwarded by your router across the LAN is immediately dropped with an RST packet by your operating system kernel.
Binds to all local network adapters, including your machine's private LAN IP (e.g. 192.168.1.50). This allows incoming forwarded router packets to reach the listening application.
Select Your Operating System
Click OS to view native commandsWindows (PowerShell & Command Prompt)
Modern Windows 10, 11, and Windows Server feature native PowerShell cmdlets to inspect TCP states without parsing strings:
Displays all open listening ports sorted numerically alongside their process IDs (OwningProcess).
To find the specific executable name associated with the process ID (e.g. PID 1420):
Replace 1420 with your OwningProcess PID to identify the program.
The -a flag lists all connections, -n keeps numbers numerical, and -o lists the owner process ID.
4-Step Port Forwarding Verification Checklist
Run the OS command above. If your port number does not appear in the command output at all, the application is stopped, crashed, or still initializing.
If the socket shows 127.0.0.1, edit your server configuration:
app.listen(PORT, '0.0.0.0')uvicorn.run(app, host='0.0.0.0', port=PORT)server.properties, keep server-ip= completely blankpostgresql.conf, set listen_addresses = '*'Confirm your application responds locally before touching router settings:
curl -I http://localhost:PORT
Testing your public IP from inside your home network often fails due to lack of NAT Loopback (Hairpin NAT) support on consumer routers. Use onmyport.com's external edge servers to probe your actual public reachability.