Why you need to know if a port is open

A port is a numbered channel that your computer uses to send and receive data. When you visit a website, your browser opens port 80 or 443. When you run a game server or remote access tool, it opens a specific port to let traffic in. If that port is closed, the connection fails — either because a firewall is blocking it or because nothing is listening on that port.

Checking whether a port is open tells you two things: whether your firewall is blocking it, and whether the program using that port is actually running. This matters when you set up a home server, test a new process, or troubleshoot why a device cannot reach another device on your network.

You have three ways to check: from the computer that owns the port, from another device on your network, and from outside your network. Each one answers a different question and uses different tools.

Key Takeaways

  • Use netstat on Windows or lsof on Mac and Linux to see which ports your own computer is listening on right now.
  • Use telnet or nmap from another device to test whether a port on a different computer is reachable across your network.
  • Port forwarding in your router is required if you want to test a port from outside your home network, and it creates a security risk if left open.
  • A port can be open (listening) but still unreachable if a firewall rule blocks it, so check both the process and the firewall.
  • Most home routers block incoming connections by default, so a port that works inside your network may not work from the internet.

Check which ports your own computer is using

The fastest way to see if a port is open on your own machine is to list all the ports your computer is currently listening on. On Windows, open Command Prompt (search for "cmd" in the Start menu) and type:

netstat -ano | findstr LISTENING

This shows every port your computer has open, the program using it, and its process ID. Look for the port number you are testing — if it appears in the list with a status of LISTENING, the port is open and something is using it.

On Mac or Linux, open Terminal and type:

lsof -i -P -n | grep LISTEN

This shows the same information: which ports are listening, what program owns them, and whether they are bound to your local network only or to all network interfaces. If you see your port number in the output, it is open.

Test a port on another device on your network

If you want to check whether a port on a different computer is reachable from another device, use telnet. This is the simplest test and works on Windows, Mac, and Linux.

On the computer you want to test from, open Command Prompt (Windows) or Terminal (Mac/Linux) and type:

telnet 192.168.1.100 8080

Replace 192.168.1.100 with the IP address of the computer you are testing, and 8080 with the port number. If the port is open and listening, the screen will go blank or show a cursor — that means the connection succeeded. If you see "Connection refused" or "Connection timed out", the port is closed or blocked.

On Windows, telnet may not be installed by default. If the command does not work, go to Control Panel, select Programs, then Programs and Features, click "Turn Windows features on or off", check the box next to Telnet Client, and click OK. Then try the telnet command again.

If telnet feels too technical, you can also use an online port checker tool by entering your router's public IP address and the port number — but this only works if you have set up port forwarding in your router, which most home networks have not.

Use nmap for a more detailed port scan

nmap is a network scanning tool that shows you not just whether a port is open, but also what state it is in and sometimes what service is running on it. It is more powerful than telnet and gives you more information.

read nmap from nmap.org and install it. Then open Command Prompt or Terminal and type:

nmap 192.168.1.100 -p 8080

Replace the IP address and port with your target. nmap will report whether the port is open, closed, or filtered (blocked by a firewall). If it is open, nmap may also identify the service running on it.

You can scan multiple ports at once by typing:

nmap 192.168.1.100 -p 80,443,8080

This is especially useful when you are setting up a new device and want to see all the ports it is listening on without logging into it directly.

Check your firewall rules if a port should be open but is not

If you confirmed that a program is listening on a port (using netstat or lsof) but telnet or nmap says the port is closed, your firewall is blocking it. Every operating system has a built-in firewall, and it can block ports even when the program is using them.

On Windows, open Windows Defender Firewall (search for "firewall" in the Start menu), click "Allow an app through firewall", and look for your program in the list. If it is there but unchecked, check the box. If it is not there, click "Allow another app", find your program, and add it.

On Mac, go to System Preferences, click Security & Privacy, select the Firewall tab, and click Firewall Options. You can add programs to the allow list there, though macOS is less restrictive than Windows by default.

On Linux, the firewall depends on your distribution. Most use ufw (Uncomplicated Firewall). To allow a port, type:

sudo ufw allow 8080

After you change any firewall rule, test the port again with telnet or nmap to confirm it is now reachable.

Testing a port from outside your home network

If you want to test whether a port is reachable from the internet (not just from other devices in your home), you need to set up port forwarding in your router first. Port forwarding tells your router to send incoming traffic on a specific port to a specific device on your network.

Log into your router's admin panel (usually 192.168.1.1 or 192.168.0.1 in your browser), find the Port Forwarding section, and create a rule that forwards the port to your device's local IP address. The exact steps vary by router model, so check your router's manual.

Once port forwarding is set up, you can test the port from outside using an online port checker tool or by using nmap from a device on a different network. However, leaving a port open to the internet is a security risk — close the port forwarding rule as soon as you finish testing, and only open ports you actually need for a specific purpose.

Common reasons a port appears closed when it should be open

The program is not running. Check that the process you expect to be listening on that port has actually started. Use netstat or lsof to confirm something is listening.

The program is listening on localhost only. Some applications listen only on 127.0.0.1 (your local machine) rather than on your network interface. This means other devices cannot reach it. Check the program's configuration to bind it to your network IP instead.

The port number is wrong. Confirm you are testing the correct port number. Many programs let you choose which port to use, and it is straightforward to test the wrong one.

A firewall rule is blocking it. Check both your operating system firewall and your router's firewall. Some routers have a built-in firewall that blocks incoming connections by default.

Port forwarding is not set up. If you are testing from outside your network, port forwarding must be configured in your router. Without it, incoming traffic on that port is dropped at the router.

Frequently Asked Questions

What is the difference between a port being open and a port being in use?

A port is in use when a program has opened it and is listening for connections. A port is open when it is in use and reachable from another device. A port can be in use but not open if a firewall blocks it, or if the program is listening only on localhost.

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

Yes. On Windows, you can read a graphical tool like Angry IP Scanner or Advanced Port Scanner, which show open ports with a user interface instead of commands. On Mac, Network Utility (included with older versions) or third-party tools like LanScan work similarly. However, the command-line tools are faster and more reliable.

Is it dangerous to leave a port open?

Only if it is open to the internet. A port open on your local network is safe as long as you trust the other devices on that network. A port open to the internet through port forwarding is a potential security risk — it gives anyone on the internet a way to reach that service. Close port forwarding when you are not using it, and only open ports for services you actually need.

Why does my port work inside my network but not from the internet?

Your router blocks incoming connections from the internet by default. To make a port reachable from outside, you must set up port forwarding in your router to direct traffic to your device. Without it, the router drops the incoming connection.

What if telnet says "Connection timed out" instead of "Connection refused"?

Connection timed out usually means the firewall is silently dropping the connection rather than actively refusing it. Connection refused means something is listening but rejecting the connection. Both indicate the port is not reachable, but the timeout suggests a firewall rule rather than a closed port.