How to Check If a Port Is Open (Windows, Mac, Linux, Online)
“Is this port open?” can mean two different things: is a program listening on the port on your own computer, or can the internet reach it? You usually need to check both. A port only works for visitors when a program listens on it, the computer's firewall lets traffic in, and your router passes the connection along.
In brief: to test from outside, run an online port checker from the network you want to test. To see what is listening locally, use netstat or Get-NetTCPConnection on Windows, and lsof or ss on macOS and Linux. To test a connection to another machine, use Test-NetConnection on Windows or nc -zv on macOS and Linux.
Open, closed or filtered: what the result means
Every port check ends in one of three results, and each one points to a different fix. They come from how TCP answers a connection request. When nothing listens on a port, the host replies with a reset, and RFC 9293 (section 3.5.2) says a connection request with no matching connection is rejected that way. A firewall that drops the request sends nothing back at all.
| Result | What happened | What it usually means |
|---|---|---|
| Open | The connection was accepted | A program is listening and nothing blocks the path |
| Closed (connection refused) | The host answered with a reset | The host is reachable, but no program listens on that port, or a firewall rule rejected the connection |
| Filtered (no response, timed out) | No answer before the time limit | A firewall or router dropped the request on the way |
Nmap uses the same words. Its manual defines filtered as a port where packet filtering stops its probes from reaching the port, so it cannot tell whether the port is open (Nmap port scanning basics).
Method 1: Check from the internet with an online tool
An online check tells you whether the internet can reach a port on your public IP address, which is the question that matters for port forwarding, game servers and remote access. Open our port checker, type the port number and press Check. The server tries a TCP connection to the public IP address your request came from and reports Open, Closed or No response.
A few details matter when you read the result:
- It tests TCP ports from 1 to 65535. It cannot test UDP, and it cannot test port 25, because Cloudflare Workers, where ipcomet runs, prohibit connections to that port (Cloudflare TCP sockets docs).
- It waits 4 seconds. If nothing answers by then, it reports No response.
- It tests the address it sees. Turn off any VPN or proxy first, or you will be testing the VPN server instead of your own connection. Our IP checker shows which address websites see.
- It always tests the public address your request came from, so it cannot test a private address such as 192.168.1.50.
- If you connect over IPv6, it tests your IPv6 address. There is no NAT on IPv6, so port forwarding does not apply. RFC 6092 recommends that home routers filter unsolicited inbound IPv6 connections, so you allow the port in the router's IPv6 firewall settings instead (RFC 6092).
What our test showed
On 4 December 2026 we checked ports 443 and 22 from the connection we write these guides on, with no port forwarding set up. Both came back as No response after the full 4 seconds. That is what a router or firewall shows from outside when it drops connections nobody asked for. A port only shows as Open once a program listens on it and the router forwards the port to that machine.
Method 2: Windows
On Windows, netstat or Get-NetTCPConnection shows what is listening on your own PC, and Test-NetConnection tests a port on another machine.
To see whether your PC listens on port 8080, open Command Prompt and run:
netstat -ano | findstr LISTENING | findstr :8080
Any line it prints means a program is waiting on that port. The first filter keeps listening ports only, so outgoing connections to port 8080 on other machines are left out. The -a option lists listening ports, -n shows numbers instead of names, and -o adds the process ID of the program (Microsoft netstat reference). Match that process ID in Task Manager's Details tab to see which program it is.
PowerShell gives the same answer with a cleaner output:
Get-NetTCPConnection -LocalPort 8080 -State Listen
The OwningProcess column holds the process ID (Get-NetTCPConnection reference).
To test a port on another machine, use:
Test-NetConnection -ComputerName 192.168.1.50 -Port 443
Look for TcpTestSucceeded : True. False means the connection was refused or timed out. Test-NetConnection only tests TCP ports (Test-NetConnection reference). Older guides suggest telnet for the same job, but Windows has to have the Telnet client installed before that command runs (Microsoft telnet reference).
Not sure which port a service uses? Our common ports list has the standard numbers.
Method 3: macOS and Linux
On a Mac or Linux machine, lsof or ss lists listening ports, and nc (netcat) tests a port on another machine.
- What is listening locally:
sudo lsof -nP -iTCP -sTCP:LISTENworks on both. The-iTCP -sTCP:LISTENpair limits the list to TCP ports in the listening state, and-Pkeeps port numbers as numbers (lsof manual). - On Linux,
sudo ss -ltnpdoes the same:-lfor listening sockets,-tfor TCP,-nto skip name lookups and-pfor the process. Use-lunpfor UDP (ss manual). - To test another machine:
nc -zv -w 5 example.com 443. The-zoption checks for a listener without sending data,-vprints the result, and-w 5sets a 5-second timeout (nc manual). The nc that ships with macOS takes its connection timeout from-Ginstead, so usenc -zv -G 5 example.com 443there.
What nc printed in our test
We ran nc on macOS 26.7.1 on 4 December 2026 against three ports, one for each result in the table above:
- Port 443 on ipcomet.com:
Connection to ipcomet.com port 443 [tcp/https] succeeded!(open). - Port 9 on the Mac itself, where nothing listens:
Connection refusedstraight away (closed). - Port 81 on ipcomet.com, with
-G 5:Operation timed outtwice, after 10 seconds in all, because nc tried both of the site's IPv4 addresses for 5 seconds each (filtered).
A refusal answers fast because the host sends a reset. A timeout takes as long as the limit you set, because nothing ever comes back.
How to test a UDP port
UDP ports are harder to confirm, because UDP has no connection handshake (RFC 768). A host that gets a UDP packet for a port with no listener should answer with an ICMP Port Unreachable message (RFC 1122, section 4.1.3.1). That reply is the only clear sign of a closed port, and a reply from the service itself is the only clear sign of an open one. An open port often stays silent when it gets a packet it does not understand, and so does a firewall that drops the packet. Nmap reports a UDP port with no reply as open|filtered for that reason (Nmap scan techniques). Netcat's -zu check tells you even less. With -z it sends no data, and when we ran nc -zuv -w 3 127.0.0.1 9 on macOS on 4 December 2026 it printed succeeded for UDP port 9 on the Mac itself, where nothing listens. The most reliable test is a real request from the program that uses the port, such as a game client or a DNS query.
Method 4: Scan with Nmap
Nmap checks many ports in one run and labels each one. nmap -p 22,80,443 192.168.1.50 reports each port as open, closed or filtered, and sudo nmap -sU -p 53 192.168.1.50 checks a UDP port. Nmap knows six states in total: open, closed, filtered, unfiltered, open|filtered and closed|filtered (Nmap port scanning basics). Only scan machines you own or have permission to test, because scanning other people's systems can break the law or a provider's terms.
Why is a port closed when it should be open?
Work through the path from the program outwards.
- Make sure the program is running and listening on the right port and the right address. Check with the local commands above. A service bound to
127.0.0.1only accepts connections from the same machine, so other devices get Closed. - Allow the port in the computer's firewall. A blocked port usually shows as No response from outside.
- Forward the port on your router to the device's private address. Without a forwarding rule the router drops the connection. See what port forwarding is, and find your router's IP address to open its settings.
- Check for carrier-grade NAT. If the WAN address on your router's status page falls between 100.64.0.0 and 100.127.255.255 (the shared range in RFC 6598), your provider puts a NAT of its own between you and the internet, and inbound connections usually cannot reach you. Our guide to CGNAT covers the options.
- Look for a second router. If the WAN address is a private one such as 192.168.x.x, or differs from the address on our IP checker without being in that shared range, another router sits in front of yours. Two routers in a row (double NAT) need a forwarding rule on both, or one of them in bridge mode. What is NAT explains why.
- Remember UDP. A UDP service can work fine while TCP-only checks such as ours cannot see it at all, and Nmap can only report it as open|filtered.
Which port numbers can you check?
Port numbers run from 0 to 65535, because TCP and UDP store the port in a 16-bit field (RFC 6335). IANA splits them into three ranges:
| Range | Name | Used for |
|---|---|---|
| 0 to 1023 | System (well-known) ports | Standard services such as SSH (22), HTTP (80) and HTTPS (443) |
| 1024 to 49151 | User (registered) ports | Services registered with IANA, such as MySQL (3306) and PostgreSQL (5432) |
| 49152 to 65535 | Dynamic (private or ephemeral) ports | Never assigned by IANA, also called ephemeral ports |
The IANA port number registry lists every assignment, and our common ports list has the ones you are most likely to need.
Frequently asked questions
Why does the online check say No response when my program is running?
The program is listening, but something between the internet and the program drops the connection. Check the computer's firewall first, then the port forwarding rule on your router, then whether your provider uses carrier-grade NAT.
Can I check whether a port is open on someone else's server?
You can test a single connection to a public service, for example Test-NetConnection or nc -zv to a website's port 443, the same way a browser connects. Scanning ranges of ports on systems you do not own needs the owner's permission.
Does an open port mean my computer is at risk?
An open port means a program accepts connections from the network, so the risk depends on that program and how well it is kept up to date. Close or block ports for services you do not use, and keep the ones you need patched.
Sources and further reading
- RFC 9293: Transmission Control Protocol (TCP)
- RFC 768: User Datagram Protocol
- RFC 1122: Requirements for Internet Hosts
- RFC 6335: Port number registry procedures
- RFC 6598: Shared address space for carrier-grade NAT
- RFC 6092: Simple security in IPv6 home gateways
- IANA Service Name and Transport Protocol Port Number Registry
- Microsoft: Test-NetConnection
- Microsoft: Get-NetTCPConnection
- Microsoft: netstat
- ss(8) Linux manual page
- lsof(8) manual page
- nc(1) OpenBSD manual page
- Nmap reference guide
- Cloudflare Workers: TCP sockets
Try it yourself
See the real numbers for your own connection with our free tools.