Network security

What Are Open Ports? How They Work, Common Ports and Which to Close

An open port is a door a program leaves open so other computers can talk to it. Some doors need to stay open; most should stay shut.

Cysoro Security TeamPublished · 8 min read
443HTTPS 22SSH 8080ALT HTTP 3389RDP — CLOSE ss -tuln · netstat -ano0–65,535 · TCP and UDP NETWORK SECURITY Openports Which doors to keep — and which to shut.
Quick answer

An open port is a numbered doorway on a computer or server where a program is actively listening for incoming network connections. Every port number from 0 to 65,535 belongs to a service: port 443 for HTTPS websites, port 22 for SSH, port 3389 for remote desktop. A port is only a risk when the service behind it is unnecessary, unpatched or exposed to the internet.

Key takeaways

  • An open port means a specific program is listening — the port number tells you which service, not the machine in general.
  • Ports 443 and 80 are normal on a web server; 3389, 445 and database ports should almost never face the internet.
  • Check your own ports with built-in commands, then close or firewall anything you do not recognize or need.

Every time a security report says a server was breached through an exposed service, an open port is usually part of the story. Ports are not mysterious, and they are not automatically dangerous — but you should know which ones are open on your systems, and why.

What are open ports?

An open port is a numbered endpoint on a computer where a program is actively listening for incoming network connections. The IP address names the machine; the port number names the program on that machine. That is how one server can be a website, a mail server and an SSH host at the same address without the traffic getting mixed up.

There are 65,536 ports for TCP and the same number again for UDP, numbered 0 to 65,535. When a port is open, it always means a specific program is listening — never something vague about the machine in general. If nothing is listening, the port is closed, and connection attempts are refused.

Ports fall into three ranges set by IANA, the Internet Assigned Numbers Authority — see the common ports cheat sheet for the full list — the Internet Assigned Numbers Authority, which keeps the official registry of which service each port belongs to.

Well-known ports (0–1,023) hold the foundational services such as DNS, HTTP and HTTPS. Registered ports (1,024–49,151) belong to specific applications such as MySQL and remote desktop. Dynamic ports (49,152–65,535) are picked by your computer as the source port for outgoing connections.

How do ports work?

When your browser loads a website, it opens a connection to the server's IP address on port 443, the HTTPS port. The server's web software is listening there, so it answers. Your computer picks a random dynamic port as its own end of the connection, which is how it can hold many connections at once.

A connection is identified by four things: the source IP, the source port, the destination IP and the destination port. That four-part combination is why one server port can serve thousands of clients at the same time, and why a firewall can allow port 443 while blocking everything else.

TCP and UDP use separate port spaces. TCP is the reliable protocol: it checks that every packet arrives, which suits web pages, email and file transfers. UDP sends packets without checking, which suits DNS lookups, video calls and gaming, where speed matters more than perfect delivery. TCP port 53 and UDP port 53 are different doors, even though both belong to DNS.

IP address finds the machine. Port finds the program. Your browserwants a web pagefrom 203.0.113.10 The internetroutes by IPto the server The serverport 443: web serverport 22: SSH login Same IP, different ports = different programs203.0.113.10:443 serves the website · 203.0.113.10:22 serves remote login · 203.0.113.10:3306 serves the database
One IP address, many ports — each port is a different program answering. Illustration by Cysoro.

What are the most common open ports?

You will meet the same dozen ports again and again. The TCP and UDP port reference follows the IANA registry port by port. Learn them once and most port lists become readable at a glance.

PortProtocolServiceWhat it doesSafe to expose?
80TCPHTTPUnencrypted web trafficWeb servers only; usually redirects to 443
443TCP/UDPHTTPSEncrypted web traffic; UDP 443 is HTTP/3Yes, on web servers
22TCPSSHEncrypted remote login and file transferOnly when hardened, ideally behind a VPN
25TCPSMTPMail routing between serversMail servers only
53TCP/UDPDNSHostname-to-IP lookupsOnly on intended DNS servers
110 / 995TCPPOP3 / POP3SEmail retrievalUse the encrypted 995, not 110
143 / 993TCPIMAP / IMAPSEmail retrievalUse the encrypted 993, not 143
587TCPSMTP submissionWhere mail clients send mailYes, with authentication and TLS
3389TCP/UDPRDPWindows Remote DesktopNo — never expose directly
3306TCPMySQL / MariaDBDatabase connectionsNo — internal only
5432TCPPostgreSQLDatabase connectionsNo — internal only
27017TCPMongoDBDatabase connectionsNo — never expose
445TCPSMBWindows file and printer sharingNo — never expose to the internet
23TCPTelnetUnencrypted remote loginNo — should not exist on modern networks

Two ports deserve special attention. Port 3389, Remote Desktop, is a favorite ransomware entry point: attackers scan the whole internet for it and brute-force the login. Port 445, Windows file sharing, has been abused by worms for decades and should never face the internet. If either shows up on a public scan of your network, treat it as urgent.

What is the difference between open, closed and filtered ports?

A port scan reports three states. Open means a program is listening and answered. Closed means nothing is listening and the machine refused the connection. Filtered means a firewall blocked the probe, so the scanner cannot tell whether anything is listening behind it.

Filtered is usually the state you want for ports you do not need to expose. It gives an attacker no information at all. Closed is fine too, but it confirms the machine exists. Open is only a problem when the service behind it should not be reachable — which is a decision about the service, not about the number.

Why are open ports a security risk?

Every open port is an invitation to try the service behind it. Attackers scan the entire internet continuously, looking for open ports on services with known flaws, weak passwords or default settings. A database port left open with no password has led to real breaches, as has an unpatched remote desktop service.

The risk is not the port number itself. Port 443 is open on every website you visit, and that is fine, because the web server behind it is patched and hardened. The risk is a port that is open by accident — a development server, a forgotten test database, a default service nobody turned off — and exposed to everyone.

That is also why port numbers protect nothing on their own. Moving SSH from port 22 to a random high port hides it from casual scans, but a full scan finds it in seconds. Security through obscurity buys minutes, not safety. Patch the service, require strong authentication, and restrict who can reach it.

How do I check which ports are open?

Check from inside first, then from outside. The inside view shows every listening program; the outside view shows what the internet can actually reach. The two lists are often different, and the difference is where the problems hide.

Check on your own computer

On Windows, open a terminal and run netstat -ano. On macOS or Linux, run ss -tuln. Both list listening ports and, on Windows, the process ID behind each one. Look for anything you do not recognize, then work out which program owns it before you close it.

Check from the internet

For a server, scan it from outside your network. A port scanner such as Nmap, run with permission against your own server, shows exactly what an attacker sees.

You can also check what your public address looks like with our free what is my IP tool.

To look up the domain behind a server, use our free DNS lookup.

Only scan systems you own or have permission to testScanning someone else's network without permission is illegal in most countries, even if you mean well. Stick to your own servers, your own home network, and services that explicitly invite testing.

Check your home router

Most home networks expose nothing, because the router's firewall blocks incoming connections by default. Ports become exposed when someone enables port forwarding — for a game server, a camera or remote access — and forgets about it. Log into your router, review the port-forwarding rules, and remove any you no longer use. Our guide to how to secure your Wi-Fi covers the router settings worth checking.

Which open ports should you close?

Close anything you do not need, and firewall anything you need only internally. The default answer for a small business is simple: only the ports your public services need should face the internet.

Which ports stay open — and which never should ✓Keep, if needed443 HTTPS · 80 HTTP25 SMTP (mail servers)53 DNS (DNS servers)587 mail submission !Restrict tightly22 SSH — VPN or allowlist1194 OpenVPN — VPN only993 / 995 — encrypted mail8080 — often exposed byaccident; check it ✕Never expose3389 RDP · 445 SMB3306 MySQL · 5432 Postgres27017 MongoDB · 6379 Redis23 Telnet · 21 FTP Rule of thumb: if you cannot name the service and the reason it faces the internet, close it.
Traffic-light guide to common ports. Illustration by Cysoro.
  • Close Telnet (23) and FTP (21) outright. Both send credentials in plain text. SSH and SFTP replace them.
  • Close database ports (3306, 5432, 27017, 1433, 6379) at the firewall. Databases should only accept connections from your own application servers.
  • Close RDP (3389) and SMB (445) to the internet. Use a VPN for remote access and internal file sharing.
  • Restrict SSH (22) to trusted IP addresses where possible, disable password login in favor of keys, and add multi-factor authentication.
  • Check port 8080. It is the common alternate HTTP port, and it is often exposed by accident on development servers, Jenkins and admin panels.

After closing a port, verify it from outside. A firewall rule that looks right in a console but does not actually block traffic is worse than no rule, because it creates false confidence.

What should you do if a scan finds unexpected open ports?

Do not panic, and do not ignore it either. Work through the list one port at a time: identify the program, decide whether it needs to be reachable, and either close it, restrict it or patch it.

  1. Identify the service. Match the port to the program listening on it, on the machine itself.
  2. Ask who needs it. If nobody can name a reason, close it. If only your office needs it, restrict it to your office IP range.
  3. Patch it. If the service must stay open, make sure it is fully patched and running the latest version.
  4. Strengthen login. Disable default credentials, require strong passwords or keys, and add MFA where the service supports it.
  5. Rescan. Confirm the port is closed or filtered from outside, and repeat the check after every major change.

For servers, make this a routine: include a port review in your regular vulnerability scanning cycle, so new services get noticed within weeks, not years.

The bottom line

An open port is a program waiting for a connection. Most of the time that is exactly what you want — your website on 443, your mail on 587. The trouble starts with the ports you forgot about: a database, a remote desktop, a test server that nobody turned off.

List your listening ports, close what you do not need, restrict what you do, and check again from the outside. You can start with the public side right now using the free SSL checker to confirm your website's encryption is sound.

Frequently asked questions

What are open ports in simple terms?

Think of your computer as a building and ports as numbered doors. An open port is a door with a program behind it, ready to answer anyone who knocks. Port 443 is the door for secure websites, port 22 for remote login.

Are open ports dangerous?

Not by themselves. A web server needs port 443 open. The danger comes when a port is open to the internet for a service you do not need, or one with a known flaw — then anyone on the internet can knock on it.

How many ports are there?

There are 65,536 ports for TCP and the same number again for UDP, numbered 0 to 65,535. Ports 0 to 1,023 are well-known system ports, 1,024 to 49,151 are registered ports, and 49,152 to 65,535 are dynamic ports used for outgoing connections.

What is the difference between TCP and UDP ports?

TCP ports carry connections that check every packet arrives, like web pages and file transfers. UDP ports carry fire-and-forget traffic, like DNS lookups and video calls. TCP port 53 and UDP port 53 are completely separate doors.

How do I check which ports are open on my computer?

On Windows run netstat -ano in a terminal, on macOS and Linux run ss -tuln. Both list listening ports and the program behind each one. For a server, scan it from outside with a port scanner to see what the internet sees.

Should I close port 3389?

Yes, unless you have a specific, hardened reason to expose Remote Desktop to the internet. Port 3389 is a favorite ransomware entry point. Use a VPN instead, or at minimum restrict it to trusted IP addresses and require multi-factor authentication.

What does it mean if a port is filtered?

Filtered means a firewall is blocking the port, so a scanner cannot tell whether anything is listening behind it. That is usually the state you want for ports you do not need to expose.

Can a website tell which ports I have open?

No, not directly. A website can only see the connection you made to it. An attacker would need to scan your public IP address, which is why a firewall in front of your network matters.

Sources

  1. NR Tech Studio — TCP and UDP Port Reference
  2. mlab.sh — Common Network Ports Cheat Sheet
  3. SimpleProg — Common Ports and Protocols
  4. ZAP-Hosting — Common Ports: List and Firewall Commands
Written & fact-checked byCysoro Security Team

The engineers and analysts who build Cysoro's domain scanner, email-authentication checks and free security tools. We test what we write about every day — SPF, DKIM, DMARC, certificates, look-alike domains and phishing — and check each guide against the relevant standards, government guidance and vendor documentation.

  • Email authentication
  • Phishing & BEC
  • Domain & DNS security
  • Small-business security

Checked against the IANA port registry as summarized in the TCP and UDP port references cited, and standard TCP/UDP networking references.

How we write and fact-check →

Free tools for this topic

No account needed.

See where your domain stands

Free for up to 3 domains. No card, no installs.

Start free