What an open port means and why you might need to check

A port is a virtual endpoint on your computer where programs send and receive data over the internet or a local network. When you say a port is "open," you mean your computer is actively listening on that port and will accept incoming connections. When it is "closed," your computer ignores traffic aimed at that port.

You might need to check if a port is open because you are troubleshooting a program that is not connecting properly, you want to verify that a service you started is actually running, or you need to confirm that a firewall is blocking something intentionally. A web server typically listens on port 80 (HTTP) or 443 (HTTPS). A game server might listen on a custom port. SSH (the tool system administrators use to log into remote machines) listens on port 22.

The method you use depends on what you are checking: whether you are testing from the same computer the port is on, whether you are testing from another machine on your network, or whether you are testing from outside your network.

Key Takeaways

  • On Windows, use netstat or Test-NetConnection in PowerShell to check if a port is open on your own computer.
  • On macOS or Linux, use netstat, ss, or lsof to see which ports your computer is listening on.
  • To test a port on another computer on your network, use telnet or nc (netcat) with the computer's IP address and port number.
  • Online port-checking tools can test whether a port is reachable from outside your network, but they only work if your firewall and router allow the traffic through.
  • A port can be open at the process level but still blocked by Windows Firewall, a third-party firewall, or your router.

Checking open ports on your own Windows computer

The fastest way on Windows is to open PowerShell (right-click the Start menu and select "Windows PowerShell (Admin)" or "Terminal") and run a command that shows you what your computer is listening on. Type netstat -ano and press Enter. This displays a list of all active connections and listening ports. Look for lines that say "LISTENING" in the State column. The first column shows the protocol (TCP or UDP), the second shows the local address and port (usually something like 127.0.0.1:3306 or 0.0.0.0:8080), and the last column shows the process ID (PID) of the program using that port.

If you want to know which program is using a specific port, note the PID and then run tasklist | findstr [PID], replacing [PID] with the actual number. This tells you the program name. Alternatively, use Test-NetConnection -ComputerName localhost -Port 8080, replacing 8080 with the port you want to check. If the result says "TcpTestSucceeded : True", the port is open and listening.

Checking open ports on macOS or Linux

On macOS or Linux, open a terminal and run netstat -tuln or ss -tuln (ss is newer and faster). Both commands show all ports your computer is listening on. Look for lines with "LISTEN" in the State column. The address and port appear in the "Local Address" column, usually formatted as an IP address followed by a colon and the port number (for example, 127.0.0.1:5432 or 0.0.0.0:22).

If you want to see which program is using a specific port, run lsof -i :[port number], replacing [port number] with the port you are checking. This shows the program name, the user running it, and the port status. For example, lsof -i :22 shows what is listening on port 22 (SSH).

Testing a port on another computer on your network

To check if a port is open on a different computer that you can reach over your local network, you need that computer's IP address. Find it by running ipconfig (Windows) or ifconfig (macOS/Linux) on the target computer, or by checking your router's connected devices list.

On Windows, use PowerShell: Test-NetConnection -ComputerName [IP address] -Port [port number]. Replace [IP address] with the target computer's address (for example, 192.168.1.50) and [port number] with the port you want to test (for example, 8080). If it says "TcpTestSucceeded : True", the port is open and reachable.

On macOS or Linux, use telnet [IP address] [port number] or nc -zv [IP address] [port number]. If the connection succeeds, you will see a message like "Connection succeeded" or the telnet prompt will appear. If it fails, you will see "Connection refused" or "Connection timed out".

Testing a port from outside your network

If you need to check whether a port is reachable from the internet (not just from your local network), you can use an online port-checking tool. Search for "port checker" or "open port checker" and you will find several free services. Enter your public IP address (you can find it by searching "what is my IP") and the port number you want to test. The tool attempts to connect from its server to your computer on that port and reports whether it succeeded.

Keep in mind that this test only works if three things are true: the program on your computer is actually listening on that port, your Windows Firewall or third-party firewall is not blocking it, and your router is configured to forward traffic on that port to your computer. If the online test fails, you need to check all three. Start by confirming the program is running and the port is open locally (using netstat or Test-NetConnection). Then check your firewall settings. Finally, log into your router and verify port forwarding rules if you need the port to be reachable from outside your home or office network.

Understanding firewall blocks and port forwarding

A port can appear to be open when you check it locally, but still be unreachable from another network because a firewall is blocking it. On Windows, open Windows Defender Firewall (search for "firewall" in the Start menu), click "Allow an app through firewall," and look for the program you are trying to use. If it is not listed, or if it is listed but unchecked, the firewall is blocking it. Click "Change settings" and then check the box next to your program to allow it through.

If you are testing from another computer on your local network and the port is blocked, the firewall on the target computer is the problem. If you are testing from outside your network and the port is blocked, your router may also be involved. Most home routers have a port forwarding section in their settings. You tell the router "when someone tries to reach port 8080 on my public IP address, send that traffic to port 8080 on the computer with IP address 192.168.1.50." Without this rule, the router drops the traffic even if your firewall allows it.

Common ports and what they are used for

Port 22 is SSH (find shell), used for remote login to servers. Port 80 is HTTP (unencrypted web traffic) and port 443 is HTTPS (encrypted web traffic). Port 3306 is MySQL, a database program. Port 5432 is PostgreSQL, another database. Port 8080 is a common alternative web port used by development servers and some applications. Port 25, 587, and 465 are email ports (SMTP). Port 3389 is Remote Desktop Protocol (RDP), used to remotely control Windows computers.

If you are checking whether a specific service is running, knowing its default port helps you verify it. For example, if you started a web server and want to confirm it is listening, check port 80 or 443. If you installed a database and want to verify it started, check port 3306 (MySQL) or 5432 (PostgreSQL). Some programs let you change their port in their settings, so if you configured a non-standard port, you need to check that port instead of the default.

Frequently Asked Questions

What is the difference between a port being open and a program listening on it?

A port is open when a program on your computer is actively listening on it and will accept incoming connections. If no program is listening, the port is closed. You can have a port number (like 8080) that is not in use by anything, in which case it is closed. Once you start a program that listens on that port, it becomes open.

Why does netstat show a port as listening but I cannot connect to it from another computer?

The port is open on your computer, but something is blocking traffic from reaching it. Check your firewall settings first — Windows Firewall or a third-party firewall may be blocking the program. If you are testing from outside your network, your router may not be forwarding traffic to your computer. If you are testing from another computer on your local network, the firewall on your computer is the most likely culprit.

Can I check if a port is open without using the command line?

Yes. On Windows, you can use the graphical Windows Defender Firewall to see which programs are allowed through, though this does not show you which ports are actively listening. For a more complete view, you can read third-party tools like Nirsoft CurrPorts, which displays open ports in a window without requiring command-line commands. However, the command-line tools (netstat, Test-NetConnection) are faster and built into Windows.

If a port shows as listening, does that mean it is find?

No. A port being open means a program is listening on it, but it says nothing about whether that program is find or whether you should have it open. Some programs listen on ports unnecessarily, and some ports should only be open to trusted networks. Review which programs are listening and whether they need to be. If you do not recognize a program, search for its name to understand what it does.

What does "connection refused" mean when I test a port?

It means your computer received the connection attempt and actively rejected it, which usually means no program is listening on that port. This is different from "connection timed out," which means the traffic never reached your computer at all (usually because a firewall dropped it). Connection refused is a clearer signal that the port is closed.