Skip to main content
Home/Blog/What are network ports and why do they matter?
Networking

What are network ports and why do they matter?

Learn about network ports, their role in computer communication, and why they

By Inventive HQ Team•
What are network ports and why do they matter?

Port Reference

Comprehensive network port reference database with search - 5,900+ ports

Open the full Port Reference tool →
Loading interactive tool...

Understanding Network Ports

A network port is a 16-bit number, from 0 to 65,535, that identifies a specific service or connection on a device that already has an IP address. The IP address routes traffic to the correct machine; the port number routes it to the correct program on that machine. A connection is uniquely identified not by the port alone but by a four-part tuple — source IP, source port, destination IP, destination port — which is why a single web server can hold thousands of open connections on the same port 443 at once. Ports come in three IANA-defined ranges (well-known 0-1023, registered 1024-49151, dynamic 49152-65535), and TCP and UDP each keep their own independent copy of that entire number space.

That is the summary an AI Overview would hand you — technically correct and instantly forgettable. What it can't show you is how the routing actually works packet by packet, which ports you should never expose, and how to read what a scanner tells you. So below you'll find an animated diagram of port multiplexing, a decision table for the three ranges, a copy-paste port-to-service map, and a troubleshooting table for the exact states nmap reports. The Port Reference tool in the sidebar lets you search all 5,900+ registered ports as you read.

One IP address, many ports: how a server multiplexes services An animated diagram showing three clients sending packets to the same server IP but different destination ports, each routed to a separate listening service. One IP address routes to many services by port Browser wants :443
<rect x="24" y="177" width="150" height="46" rx="8" fill="#ffffff" stroke="#e2e8f0"/>
<text x="99" y="197" text-anchor="middle" font-weight="700" fill="#0f172a">SSH client</text>
<text x="99" y="214" text-anchor="middle">wants :22</text>

<rect x="24" y="284" width="150" height="46" rx="8" fill="#ffffff" stroke="#e2e8f0"/>
<text x="99" y="304" text-anchor="middle" font-weight="700" fill="#0f172a">App server</text>
<text x="99" y="321" text-anchor="middle">wants :3306</text>
Server 203.0.113.10 :443 HTTPS web server
<rect x="492" y="166" width="182" height="52" rx="7" fill="#f8fafc" stroke="#e2e8f0"/>
<text x="583" y="187" text-anchor="middle" font-weight="700" fill="#15803d">:22 SSH</text>
<text x="583" y="205" text-anchor="middle" fill="#334155">shell daemon</text>

<rect x="492" y="228" width="182" height="52" rx="7" fill="#f8fafc" stroke="#e2e8f0"/>
<text x="583" y="249" text-anchor="middle" font-weight="700" fill="#15803d">:3306 MySQL</text>
<text x="583" y="267" text-anchor="middle" fill="#334155">database</text>

The OS reads the destination port and hands each packet to the right listener

When your computer communicates with another computer over the network, the connection uses a specific port number. Your browser typically uses port 80 (HTTP) or 443 (HTTPS). Your email client might use port 143 (IMAP) or 110 (POP3). Without ports, only one service could use the network at a time.

The Three Port Ranges

IANA divides the full 0-65535 space into three bands. The difference that matters day to day is who is allowed to bind to them and who assigns the number.

RangeNameAssigned byPrivilege to bindTypical useExamples
0-1023Well-knownIANA (fixed)root / administratorCore public services22 SSH, 25 SMTP, 53 DNS, 80 HTTP, 443 HTTPS
1024-49151RegisteredIANA (on request)any userVendor/app services3306 MySQL, 5432 PostgreSQL, 8080 HTTP-alt
49152-65535Dynamic / ephemeralOperating systemany userClient side of outbound connectionsTemporary source ports
Which do I pick?———Run a public standard service → well-known. Ship your own app → registered. Never hand-pick from dynamic — the OS owns that range for outbound sockets.—
The 0 to 65535 port number line split into three ranges A horizontal bar showing well-known ports 0-1023, registered ports 1024-49151, and dynamic ports 49152-65535 as three proportional bands. 65,536 ports, three jobs 0 1023 49151 65535 Well-known Registered Dynamic needs no privilege · IANA-listed apps OS-assigned · ephemeral

How Ports Enable Multiple Services

Without ports, only one service could use network communication at a time. With ports, multiple services run independently:

  • Your web server listens on port 80/443
  • Your SSH server listens on port 22
  • Your database listens on port 3306
  • Your email server listens on port 25/143/110

All these services can run simultaneously on the same computer because they listen on different ports.

When a client connects, it specifies both the destination computer (IP address) and the destination port. The operating system routes the connection to the appropriate service listening on that port.

Port vs. Protocol

Ports and protocols are related but distinct:

Port: A number identifying the endpoint (port 80) Protocol: The communication method (HTTP, HTTPS, FTP)

While port 80 conventionally carries HTTP, protocols don't require specific ports. You can run HTTPS on port 8443 instead of 443. However, conventions exist to ease communication and default to standard ports.

One subtlety that trips people up: TCP and UDP each maintain their own completely separate 0-65535 port space. TCP port 53 and UDP port 53 are different endpoints handled by different code, which is exactly why DNS uses both — UDP 53 for fast single-packet queries and TCP 53 for larger zone transfers. When you write a firewall rule, you always specify the protocol and the port together, because "allow 53" is ambiguous.

Why Ports Matter for Security

Ports are critical security considerations:

Service Exposure: Every port you open exposes a service to potential attack. Each exposed service is a potential vulnerability.

Firewall Configuration: Firewalls control which ports are accessible from outside networks. Proper firewall configuration involves opening only necessary ports and blocking the rest.

Network Monitoring: Security teams monitor port activity to detect unauthorized services, intrusions, or data exfiltration.

Vulnerability Scanning: Security tools scan port ranges to identify open ports and potentially vulnerable services.

Lateral Movement: In network compromises, attackers use port scanning to discover services on internal networks and move through the network.

Service Identification: Open ports reveal what services are running. Port 3389 open suggests Windows systems. Port 22 open suggests SSH-accessible systems.

Port Numbers and Service Mapping

Common ports and their associated services. The "Expose publicly?" column is the one to internalize — it is the difference between a hardened host and a breach.

PortProtocolServiceEncrypted?Expose publicly?
20/21TCPFTP file transferNoNo — use SFTP/FTPS
22TCPSSH secure shellYesOnly behind allowlist/VPN
23TCPTelnetNoNever — block it
25TCPSMTP mail relayOptional (STARTTLS)Mail servers only
53TCP/UDPDNS resolutionOptional (DoT/DoH)Resolvers only
80TCPHTTP webNoYes (redirect to 443)
110TCPPOP3 mail retrievalNoNo — use 995 (POP3S)
143TCPIMAP mail retrievalNoNo — use 993 (IMAPS)
443TCPHTTPS secure webYesYes
445TCPSMB file sharingNoNever — internal only
3306TCPMySQL databaseOptionalNever — internal only
3389TCPRDP remote desktopYesOnly behind VPN
5432TCPPostgreSQL databaseOptionalNever — internal only
5900TCPVNC remote desktopNoNever — tunnel it
8080TCPHTTP alternateNoApp-dependent
8443TCPHTTPS alternateYesApp-dependent

Understanding common ports helps you recognize what services are running based on port numbers. Search the full 5,900+ port database in the Port Reference tool.

Localhost and Loopback Ports

Port connections to localhost (127.0.0.1) don't traverse the network—they stay on the local computer. This is useful for local services like databases you access only from the same machine.

For example, a web application might connect to MySQL running on localhost:3306. The connection stays local and isn't exposed to the network.

Loopback connections are more secure than network-exposed connections because they can't be accessed from remote computers.

Port Forwarding and NAT

Network Address Translation (NAT) allows port forwarding, enabling external connections to internal services:

  • External computer connects to your public IP on port 80
  • Your router forwards the connection to internal computer on port 80
  • The internal web server responds

This enables services on private networks to be accessible externally, though it increases security risk.

Dynamic Port Assignment

For client connections, ports are often dynamically assigned from the private range (49152-65535). When your browser connects to a web server, the operating system assigns a temporary port for the connection. Once the connection closes, the port is released for future use.

This dynamic assignment enables millions of simultaneous connections from a single computer without port conflicts.

Port Scanning and Discovery

Port scanning discovers which ports are open on a target computer:

nmap example.com

This scans common ports and reports a state for each. The three states people confuse most are open, closed, and filtered — and the distinction between closed and filtered is what tells you whether a firewall is in the path.

Nmap stateWhat the host didWhat it meansWhat to do
openA service accepted the connectionSomething is listening and reachableConfirm it should be exposed; patch it
closedHost actively refused (TCP RST)Host is up, but no service on that portUsually fine — no action needed
filteredNo response at all (packet dropped)A firewall is silently blockingWorking as intended if deliberate; investigate if not
open|filteredAmbiguous (common with UDP)Nmap can't tell open from droppedRe-scan with a service probe (-sV)

Port scanning is valuable for network inventory and vulnerability assessment, but scanning hosts you do not own or have written authorization to test can be illegal in many jurisdictions and will trip intrusion-detection systems.

Privileged Ports and Security

Ports below 1024 (well-known ports) require administrator or root access to open. This restriction prevents non-privileged users from spoofing services:

  • Only root can open port 80 (web)
  • Only an administrator can open port 25 (SMTP)

This design prevents unprivileged users from running unauthorized services on standard ports.

Port Blocking and Filtering

Firewalls control port access:

Inbound filtering: Blocks incoming connections on specific ports Outbound filtering: Blocks outgoing connections on specific ports Stateful filtering: Tracks connection states, allowing responses to outbound connections

Proper firewall configuration blocks all unnecessary ports, exposing only required services.

Common Port Configuration Mistakes

Leaving unnecessary ports open: Every open port is a potential attack vector. Close all ports not actively used.

Using standard ports for non-standard services: Running a web server on port 22 confuses tools and people expecting SSH there.

Not documenting port usage: Without documentation, you won't remember why ports are open or which are essential.

Exposing services unnecessarily: Some services (databases, admin tools) should only be accessible from specific trusted networks.

Using insecure protocols on standard ports: Using unencrypted Telnet on port 23 is worse than blocking it entirely.

Port-Based Threat Indicators

Suspicious port activity often indicates security threats:

  • Unexplained open ports (especially high-numbered ports)
  • Services on non-standard ports
  • Unusual outbound connections on high-numbered ports
  • Scans of port ranges (potential intrusion)

Monitoring port changes helps detect intrusions and unauthorized services.

Tools for Port Management

Netstat: Shows open ports and connections

netstat -an

ss: Modern replacement for netstat

ss -tuln

nmap: Port scanning tool

nmap -p 1-65535 target.com

Lsof: Lists open files and network connections

lsof -i -P

These tools help inventory ports and troubleshoot connectivity issues.

Conclusion

Network ports are logical endpoints enabling multiple services to operate on a single computer. Understanding port numbers, their associations with services, and security implications is essential for network management and security. Ports enable the modern internet—without them, only one service could communicate at a time. For security, minimize exposed ports, firewall appropriately, and monitor for unexpected port activity. Understanding ports helps you configure networks securely, troubleshoot connectivity issues, and detect intrusions.

Network Issues Slowing You Down?

DNS problems, latency, misconfigurations — our team monitors, troubleshoots, and optimizes network infrastructure 24/7.