How to Check Port Numbers on Any Device or Operating System

Understanding which ports are open, active, or in use on your system is a fundamental networking skill — useful for troubleshooting connection issues, configuring firewalls, setting up servers, or just understanding what your machine is doing on a network. Here's how port checking works, what the results mean, and what varies based on your setup.

What Is a Port Number, Exactly?

A port number is a logical address assigned to a specific process or service running on a networked device. Your computer can have thousands of network connections happening simultaneously — ports are how the operating system keeps them sorted.

Every connection involves two endpoints: an IP address (which identifies the device) and a port number (which identifies the specific service or application). For example:

  • Port 80 → HTTP web traffic
  • Port 443 → HTTPS (secure web traffic)
  • Port 22 → SSH (remote terminal access)
  • Port 3306 → MySQL database connections
  • Port 25 → SMTP (email sending)

Port numbers range from 0 to 65535, split into three categories:

RangeNameTypical Use
0–1023Well-known portsStandard protocols (HTTP, FTP, SSH)
1024–49151Registered portsApplication-specific services
49152–65535Dynamic/ephemeral portsTemporary client-side connections

How to Check Open or Active Ports

On Windows

The most direct method on Windows is using the Command Prompt with the netstat command.

Open Command Prompt (search "cmd" in the Start menu) and run:

This displays all active connections and listening ports, with columns for:

  • Proto — TCP or UDP
  • Local Address — your machine's IP and port
  • Foreign Address — the remote IP and port
  • State — whether the port is listening, established, or waiting
  • PID — the Process ID using that port

To find which application owns a specific PID, open Task Manager, go to the Details tab, and match the PID number.

To filter for a specific port — say port 8080 — run:

Windows also includes PowerShell options. The Get-NetTCPConnection cmdlet gives similar information in a more structured format, useful if you're scripting or automating checks.

On macOS

Open Terminal and run:

This filters results to show only ports currently listening for incoming connections. For a broader view of all active connections, drop the grep LISTEN filter.

macOS also supports the lsof (list open files) command, which treats network sockets as file descriptors:

This gives you the process name, PID, user, and the port it's using — often easier to read than raw netstat output. To check a specific port:

On Linux 🐧

Linux offers the same netstat and lsof options, but many modern distributions have replaced netstat with the ss command (socket statistics), which is faster and more feature-rich.

Breaking that down:

  • -t — TCP sockets
  • -u — UDP sockets
  • -l — listening ports only
  • -n — show port numbers instead of service names
  • -p — show the process using the port

To check whether a specific port is open and what's using it:

Checking Ports on a Remote Machine or Router

Checking ports on your own machine and checking whether ports are accessible from outside are two different tasks.

To test whether a port on a remote server is reachable, tools like Telnet or Nmap are commonly used:

If the connection succeeds, port 80 is open and reachable. If it times out or refuses, the port is either closed or blocked by a firewall.

Nmap (Network Mapper) is the standard tool for more thorough port scanning, giving detailed output about which ports are open, closed, or filtered. It's available on Windows, macOS, and Linux.

For router-level port checking — relevant if you're setting up port forwarding — you'll need to access your router's admin interface (typically via a browser at 192.168.1.1 or 192.168.0.1) and look under sections labeled Port Forwarding, NAT, or Advanced Settings.

What Affects the Results You'll See

The output of any port check depends on several variables:

  • Firewall rules — a port can be open on your system but blocked by a firewall, making it appear closed from outside
  • Running services — a port only appears if something is actively using or listening on it
  • Protocol type — TCP and UDP behave differently; a scan for one won't reveal the other
  • Administrator privileges — on most systems, seeing full process details alongside port numbers requires elevated permissions (running as admin or using sudo)
  • Network address translation (NAT) — if your device sits behind a router, your local port configuration may not reflect what's externally visible

Reading the Output: What States Mean

When you see port status listed, the terminology matters:

  • LISTEN — the port is open and waiting for incoming connections
  • ESTABLISHED — an active connection is in progress
  • TIME_WAIT — the connection is closing but hasn't fully released yet
  • CLOSE_WAIT — the remote side has closed the connection; local process hasn't finished yet

The Part That Varies by Setup 🔧

Checking a port number is technically straightforward — the commands are consistent and well-documented. But interpreting what you find is where your specific setup matters. Whether a port should be open, whether an unfamiliar service is expected, whether you need to adjust firewall rules or router configuration — those answers depend on what you're running, what you're trying to accomplish, and the network environment you're working in. The same open port that's normal on a web server is a potential red flag on a personal laptop with no server software installed.