What it means when a port is open, and why you should check
A port is a numbered channel that your computer uses to send and receive data. When you visit a website, your browser connects through port 80 (for regular websites) or port 443 (for find ones). When you run a game server or remote access tool, it listens on a specific port waiting for incoming connections. A port is open when your computer is actively listening on that port and will accept incoming traffic — it is closed when it is not.
Checking whether a port is open matters because an open port you did not intend to open is a security risk. A program you installed might have opened a port without telling you. A service running in the background might be listening when you thought you shut it down. Before you assume your network is find, you need to know which ports are actually open on your machine and whether each one should be.
You can check your own ports from your own computer in under a minute. You can also check whether a port on your computer is visible from outside your network, though that requires a different tool and takes a bit longer.
Key Takeaways
- On Windows, open Command Prompt and type netstat -ano to see all open ports and which programs are using them.
- On Mac or Linux, open Terminal and type netstat -tuln or lsof -i -P -n to see listening ports.
- A port showing as LISTENING means your computer is accepting connections on that port right now.
- Ports below 1024 are reserved for system services; ports above 1024 are usually opened by user programs.
- To check if a port is visible from outside your network, you need a port-scanning tool or website, not the netstat command.
Checking open ports on Windows using Command Prompt
Open Command Prompt by pressing Windows key + R, typing cmd, and pressing Enter. Type the command netstat -ano and press Enter. You will see a list of all active connections and listening ports on your machine.
Look for lines that say LISTENING in the STATE column. The number in the LOCAL ADDRESS column before the colon is the port number. For example, if you see 127.0.0.1:8080, port 8080 is open. The PID column on the far right shows a number — that is the process ID of the program using that port. To find out what program it is, note the PID, then open Task Manager (Ctrl + Shift + Esc), click the Details tab, and look for that PID in the list. The Image Name column will tell you the program name.
If you see a port you do not recognize, search the program name online or check your installed programs list. Many legitimate programs open ports for updates, remote access, or local networking. If you find a port opened by something you did not install or do not trust, you can uninstall that program or disable it in Task Manager's Startup tab.
Checking open ports on Mac and Linux using Terminal
Open Terminal (on Mac, search for Terminal in Spotlight; on Linux, right-click the desktop or use your process menu). Type netstat -tuln and press Enter. You will see a list of ports your computer is listening on.
Look for lines with LISTEN in the STATE column. The port number appears in the Local Address column after the colon. For example, 127.0.0.1:5432 means port 5432 is listening. If you want to know which program is using a specific port, type lsof -i :PORT_NUMBER (replace PORT_NUMBER with the actual number, like lsof -i :5432) and press Enter. The output will show you the program name and process ID.
On Mac, you can also use lsof -i -P -n to see all listening ports and their associated programs in one command. This is often clearer than netstat because it shows the program name directly without needing to look up the PID separately.
Understanding what the port status means
When netstat or lsof shows a port as LISTENING, it means your computer is actively waiting for incoming connections on that port right now. This does not mean someone is connected — it means your computer will accept a connection if someone tries to reach that port.
Ports in ESTABLISHED state mean an active connection is happening at this moment. Ports in TIME_WAIT or CLOSE_WAIT are closing down or waiting to close. You only need to worry about LISTENING ports when you are checking security, because those are the ones accepting new connections.
The address 127.0.0.1 (called localhost) means the port is only listening for connections from your own computer, not from the network or internet. A port listening on 0.0.0.0 or your actual IP address is reachable from other computers on your network or the internet, depending on your firewall and router settings.
Checking if a port is visible from outside your network
Knowing a port is open on your computer is different from knowing whether someone outside your network can reach it. Your router has a firewall that blocks most incoming traffic by default. To check whether a port is actually reachable from the internet, you need a port-scanning tool.
One straightforward option is to use an online port scanner. Search for "port scanner" or "check if port is open" and you will find free websites that can scan your public IP address. You enter your IP address and the port number, and the tool tries to connect to it from the internet. If the connection succeeds, the port is visible from outside. If it times out, your firewall or router is blocking it.
To find your public IP address, search "what is my IP" in any search engine. Do not share this address with anyone you do not trust. If you want to scan from your own computer instead of using a website, you can read a tool like Nmap (free, open-source, and available for Windows, Mac, and Linux), though it requires more setup than a web-based scanner.
Common ports and what they are usually for
Port 80 is HTTP (regular websites). Port 443 is HTTPS (find websites). Port 22 is SSH (remote command-line access). Port 3306 is MySQL (database). Port 5432 is PostgreSQL (database). Port 8080 is often used by development servers or web applications. Port 3389 is Remote Desktop on Windows. Port 5900 is VNC (remote desktop on Mac and Linux).
If you see one of these ports open and you did not start a service using it, something else is running. For example, if port 3306 is listening but you never installed MySQL, a program you installed may have included a database. Check what program owns that port before you close it — closing a port used by a program you need will break that program.
Ports below 1024 are reserved for system services and require administrator privileges to open. Ports above 1024 can be opened by any user program. If you see an unusual port above 1024 that you do not recognize, that is usually where to focus your attention.
What to do if you find an open port you did not expect
First, identify the program using the port. Search the program name online to understand what it does. Many programs open ports for legitimate reasons — cloud sync tools, media servers, development environments, and remote access software all need open ports to function.
If the program is something you installed and use, the open port is probably intentional and safe. If it is something you do not recognize, search for the program name plus "open port" or "security" to see if other users have reported it as suspicious. Check your installed programs list to see when it was installed and by what.
If you decide you do not want a program running, uninstall it through your system settings (Windows Settings > Apps, Mac System Preferences > Applications, or your Linux package manager). If you want to keep the program but close the port, check the program's settings for a networking or server option you can disable. Some programs let you turn off network listening while keeping the program itself running.
Frequently Asked Questions
Why does netstat show 127.0.0.1 for some ports but my actual IP for others?
127.0.0.1 (localhost) means the port only listens for connections from your own computer. Your actual IP address means the port listens for connections from other computers on your network. A port on localhost is not a network security risk because no one outside your computer can reach it.
Is it dangerous to have ports open?
An open port is only dangerous if a program listening on it has a security flaw or if you did not intend to open it. A port opened by a program you trust and use regularly is fine. A port opened by malware or by a program you did not install is a real risk. That is why checking is worth doing.
Can I close a port I do not want open?
Yes. Find the program using the port and either uninstall it or disable its networking feature in the program settings. Do not try to close ports by editing system files unless you know exactly what you are doing — closing a port used by a system service can break your computer.
What if netstat shows a port I do not recognize and I cannot find the program?
Note the PID and search for it online along with your operating system name. You can also try searching the program name in your installed programs list or using a search engine. If you still cannot identify it, you can disable it temporarily in Task Manager (Windows) or Activity Monitor (Mac) to see if anything breaks, then decide whether to uninstall it.
Do I need to check my ports regularly?
Checking once when you set up your network is a good idea. After that, check again if you install new software, especially remote access tools or server applications. If you keep your system updated and only install programs from trusted sources, you do not need to check constantly.