How to Check Open Ports: Windows, Linux and Online Tools

Sunucun 4 min read

A port check tests whether a specific port on a device or server is reachable (open) from outside. The quickest methods are the Test-NetConnection command on Windows, nc on Linux and macOS, or an online port checker run against your own IP address.

Illustration: Linux

In this guide we explain how to check open ports, what “open”, “closed” and “filtered” results mean and what to do if a port won’t open.

Note: only scan ports on your own devices or systems you are authorised to manage. Scanning other people’s systems without permission may breach terms of use and the law.

What Is a Port and Why Check It?

A port is a numbered gate used to separate the network traffic of applications on a device. For example, websites use ports 80 and 443, SSH uses 22 and Remote Desktop uses 3389.

A port check is usually needed:

  • when a game or application server can’t be reached from outside;
  • to confirm that port forwarding on your router works;
  • to see, for security, whether unnecessary ports are left open on your server.

Port States: Open, Closed and Filtered

State Meaning
Open An application is listening on the port and accepting connections.
Closed The device is reachable but no application is listening on that port.
Filtered A firewall is blocking the packets; no response comes back.

Checking Ports on Windows

Testing whether a remote port is open

Open PowerShell and run:

Test-NetConnection server-address -Port 443

If the result shows TcpTestSucceeded : True, the port is open.

Seeing which ports are listening on your computer

netstat -ano | findstr LISTENING

To look for a specific port, use netstat -ano | findstr :3389. With the PID in the last column you can find which program is using the port in Task Manager.

Checking Ports on Linux and macOS

Remote port test

nc -zv server-address 22

A “succeeded” or “open” response means the port is open.

Listing listening ports on a server

sudo ss -tulpn

This command shows all ports listening on TCP and UDP and the services that opened them.

Scanning your own server with nmap

nmap -p 22,80,443 server-address

nmap checks several ports at once and reports whether each is open, closed or filtered.

Online Port Check Tools

If you’re checking the port of a device behind your router, the test has to be done from outside. Online port checkers try the IP and port you enter over the internet. For an accurate result:

  • make sure the relevant application (game server, camera software, etc.) is running during the test;
  • check that the IP shown by the tool matches your router’s external IP address.

What to Do If a Port Won’t Open

  1. Is the application running? If no service is listening, the port shows as closed. Check first with netstat or ss.
  2. Operating system firewall: add an inbound rule in Windows Defender Firewall. On Linux, define ufw allow 25565/tcp or a firewalld rule.
  3. Port forwarding on the router: forward traffic from the external port to your device’s local IP address. Don’t forget to give the device a static local IP.
  4. CGNAT check: if your router’s external IP differs from the IP you appear with on the internet, your ISP may be using CGNAT. Port forwarding won’t work in that case; you’ll need to request a static/public IP from your ISP.
  5. Provider firewall: if your server is in a data center, there may be a separate network firewall in the panel. Open the rule there too.
  6. The right protocol: some applications use UDP. A TCP test tells you nothing about a UDP port.

Port Checks for Security

  • Keep only the ports you actually use open on your server.
  • Protect management ports such as SSH and RDP with IP restrictions, and change the default port if needed.
  • Don’t expose database ports (MySQL 3306, PostgreSQL 5432) to the internet; allow access only from local or private networks.
  • Use a firewall on your Linux servers and review its rules regularly.

Frequently Asked Questions

Is checking ports legal?

Checking your own devices and the servers you manage is a common, legitimate administration task. Don’t scan other people’s systems without permission.

The port shows as open but I can’t connect. Why?

The application may only allow local connections in its own settings (e.g. listening on 127.0.0.1). Check that it listens on all interfaces (0.0.0.0).

Can I check a port with Telnet?

Yes; if telnet address port connects, the port is open. However, the Telnet client is disabled by default on Windows. Test-NetConnection is more practical.

How do I check UDP ports?

Because UDP is connectionless, a definite result is harder to get. You can scan with nmap -sU -p port address, but the result is often “open|filtered”. The most reliable test is to connect with the application itself.

Categories

Latest guides