What Are Network Ports? Explained Simply
In this article
Network ports are virtual endpoints that let your computer run many internet services at once. Think of an IP address as a building's street address, and the port as a specific apartment door inside that building. When data arrives, the port number tells your device which app should receive it. For example, web traffic uses port 80 (HTTP) or 443 (HTTPS), email uses port 25 (SMTP), and so on. This guide explains how ports work, how to check them, and how to troubleshoot common port-related issues.
What You'll Need
- A computer (Windows, Mac, or Linux) with internet access.
- For checking open ports: a command prompt or terminal (built into your OS).
- For testing external ports: a web browser and access to an online port checker (like yougetsignal.com or portchecker.co).
- For port forwarding: access to your router's admin page (usually via a browser at an address like 192.168.1.1 or 192.168.0.1).
Step-by-Step
- Understand the basics: A port is a 16-bit number from 0 to 65535. Ports 0–1023 are “well-known” and reserved for common services (HTTP, HTTPS, FTP, DNS). Ports 1024–49151 are “registered” for specific apps, and 49152–65535 are dynamic/private. When your device sends or receives data, it uses a combination of IP address and port number (e.g., 192.168.1.10:443).
- See which ports are listening on your computer: Open a command prompt (Windows) or terminal (Mac/Linux). Type
netstat -anand press Enter. You'll see a list of active connections and listening ports. Look for lines with “LISTENING” (Windows) or “LISTEN” (Unix). The local address column shows your IP and port, like0.0.0.0:443. - Identify what service uses a port: On Windows, use
netstat -ab(run as administrator) to see the program name. On Mac/Linux, uselsof -i :port(replace “port” with the number) to see which process is using it. - Test if a port is open externally: If you want to know if a port is reachable from the internet, use an online port checker. First, find your public IP (search “what is my IP” in a browser). Then enter that IP and the port number into the checker. If it says “open,” the port is accessible; if “closed” or “filtered,” it's not.
- Open a port on your router (port forwarding): To make a service on your computer (like a game server) reachable from the internet, you need to forward the port. Log into your router's admin page, find “Port Forwarding” or “Virtual Server,” and create a rule: enter the external port, the internal port (usually the same), and your computer's local IP address (find it with
ipconfigon Windows orifconfigon Mac/Linux). Save the rule and restart the router if needed. - Check your firewall: If a port isn't working, your firewall may be blocking it. On Windows, go to Windows Defender Firewall > Advanced Settings > Inbound Rules, and create a new rule to allow the port. On Mac, go to System Settings > Network > Firewall. On Linux, use
ufw allow port(e.g.,sudo ufw allow 25565). - Use a specific port for a service: Many apps let you change the port they use. For example, in a game server config file, you can set
port=25565. In a web server, you can change the listen port in its config file. Always choose a port above 1024 to avoid conflicts with system services.
Common Mistakes
- Confusing IP address with port: Remember, the IP finds the device, the port finds the app. Both are needed.
- Using a port that's already in use: If you try to start a service on a port that's occupied, it will fail. Check with
netstatfirst. - Forgetting to forward both TCP and UDP: Some games and apps need both protocols. When port forwarding, specify the protocol (often both).
- Using a dynamic IP for port forwarding: If your computer's IP changes, the forwarding rule breaks. Set a static IP or use DHCP reservation in your router.
- Ignoring the firewall: Even if the router forwards the port, your computer's firewall can still block it. Open the port in both places.
Tips
- Use common ports for common services: Stick to standard ports (443 for HTTPS, 22 for SSH) so clients don't need extra configuration.
- Check your router's manual: Port forwarding menus vary by brand. Look for “Port Forwarding,” “Virtual Server,” or “NAT.”
- Use a static IP for your device: Set a static IP on your computer or use DHCP reservation to keep the same IP.
- Test locally first: Before testing externally, see if the service works on your local network by using your computer's local IP and port in a browser.
- Keep a list of your forwarded ports: Write down which ports you've opened and why, so you can clean up later.
Troubleshooting
If a port test says “closed” or “filtered”:
- Verify the service is actually running on that port (use
netstat -anto see if it's listening). - Check your firewall rules – temporarily disable the firewall to test, but re-enable it after.
- Confirm the port forwarding rule is correct: external port, internal port, IP address, and protocol (TCP/UDP).
- Restart your router and computer.
- If using a VPN, disconnect it – VPNs can interfere with port forwarding.
If you can't connect to a service on your own computer:
- Try using
localhost:portin a browser – if that works, the service is fine; the issue is network-related. - Check if the service is bound to the correct IP (some services bind to 127.0.0.1 only, which blocks external access).
- Look at the service's logs for errors.
If port forwarding doesn't work after following all steps:
- Some ISPs block certain ports (like 80 or 25) – try a different high port (e.g., 8080 instead of 80).
- Your router may have a “NAT” or “UPnP” setting – enable UPnP if you want automatic forwarding, but be aware of security risks.
- Check if your ISP uses Carrier-Grade NAT (CGNAT) – if so, port forwarding won't work from the internet; you may need a VPN or a static IP.
Frequently Asked Questions
What is the difference between a port and a protocol?
A port is a number that identifies a service, while a protocol (like TCP or UDP) defines how data is transmitted. Ports work with protocols – for example, port 53 is used for DNS over both TCP and UDP.
Can two programs use the same port?
No, on the same IP address, only one program can bind to a specific port and protocol combination. If you try to start a second program on the same port, it will fail with an “address in use” error.
What is the default port for HTTPS?
HTTPS (secure web traffic) uses port 443 by default. HTTP uses port 80. You can change these, but clients assume the default unless told otherwise.
How do I find my port number for a game?
Check the game's documentation or server config file. Common ports: Minecraft uses 25565, Terraria uses 7777, and Steam games often use dynamic ports. You can also search online for “[game name] port” to find the official port.
Why does port forwarding not work on my phone?
Port forwarding is set on the router, not the phone. If you're trying to access a service on your phone from the internet, you still need to forward the port on your router to your phone's IP address. Also, mobile networks often use CGNAT, which blocks inbound connections.
Is it safe to open a port?
Opening a port exposes that service to the internet, which can be a security risk if the service isn't secure. Only open ports for services you trust, keep the software updated, and consider using a firewall to restrict access to specific IPs.