Ports Explained: Common TCP and UDP Ports
Understand network ports, how TCP and UDP use them, common port numbers and why ports are essential for Internet communication.
Network ports allow multiple applications and services to communicate over the same IP address simultaneously. Together with an IP address and a transport protocol such as TCP or UDP, a port identifies the specific service that should receive incoming network traffic. Without ports, devices would not know which application should process a received packet.
Whether you're browsing websites, sending email, connecting through SSH or playing online games, network ports are used behind the scenes to direct traffic to the appropriate service.
What Is a Network Port?
A network port is a logical communication endpoint identified by a number between 0 and 65535. Ports exist in software rather than hardware and are used by operating systems to route incoming and outgoing network traffic to the correct application.
IP Address vs Port Number
An IP address identifies a device on a network, while a port identifies a specific service or application running on that device. Together they form a socket endpoint that uniquely identifies a network connection.
| Component | Purpose |
|---|---|
| IP Address | Identifies a device |
| Port Number | Identifies a service or application |
TCP vs UDP Ports
TCP and UDP each use the same port numbering range, but they are separate transport protocols. A service may use the same port number over TCP, UDP or both depending on its communication requirements.
| Protocol | Characteristics |
|---|---|
| TCP | Reliable, connection-oriented, ordered delivery |
| UDP | Connectionless, faster, lower overhead |
Port Number Ranges
Port numbers are divided into three standard ranges based on their intended usage.
| Range | Name | Typical Usage |
|---|---|---|
| 0–1023 | Well-Known Ports | Standard Internet services |
| 1024–49151 | Registered Ports | Applications and vendor software |
| 49152–65535 | Dynamic/Ephemeral Ports | Temporary client connections |
Most Common TCP Ports
| Port | Service |
|---|---|
| 20/21 | FTP |
| 22 | SSH |
| 23 | Telnet |
| 25 | SMTP |
| 53 | DNS (TCP) |
| 80 | HTTP |
| 110 | POP3 |
| 143 | IMAP |
| 443 | HTTPS |
| 3306 | MySQL |
| 5432 | PostgreSQL |
Common UDP Ports
| Port | Service |
|---|---|
| 53 | DNS |
| 67/68 | DHCP |
| 69 | TFTP |
| 123 | NTP |
| 161 | SNMP |
| 514 | Syslog |
Why Services Use Different Ports
Different services listen on different ports so multiple applications can operate simultaneously on the same server. For example, a web server may accept HTTPS connections on port 443 while an SSH server listens on port 22, allowing secure administration without interfering with web traffic.
203.0.113.15:443
192.168.1.10:22How Ports Work
When an application wants to communicate over a network, it opens a port and waits for incoming connections or sends data through an outgoing connection. The operating system uses the destination port number to determine which application should receive each incoming packet.
Client Ports and Server Ports
Servers typically listen on well-known or registered ports, while client devices use temporary ports known as ephemeral ports. When a client connects to a server, both the source and destination ports are included in every packet, allowing multiple simultaneous connections to be tracked independently.
| Role | Typical Port Usage |
|---|---|
| Server | Well-known or registered port |
| Client | Dynamic/ephemeral port |
What Is a Socket?
A socket uniquely identifies one endpoint of a network connection. It combines an IP address, a transport protocol and a port number. Together, the source and destination socket information allow operating systems to distinguish one network connection from another.
Client: 192.168.1.25:53124
Server: 203.0.113.15:443Well-Known Network Services
Many Internet protocols use standardized port numbers so that clients know where to connect. These port assignments are widely recognized and supported by networking software around the world.
| Port | Protocol | Purpose |
|---|---|---|
| 22 | SSH | Secure remote login |
| 53 | DNS | Domain name resolution |
| 80 | HTTP | Web traffic |
| 443 | HTTPS | Encrypted web traffic |
| 3306 | MySQL | Database connections |
| 5432 | PostgreSQL | Database connections |
Open vs Closed Ports
An open port is actively listening for incoming connections because an application is using it. A closed port has no service listening, so connection attempts are rejected or ignored depending on the operating system and firewall configuration.
| Port State | Meaning |
|---|---|
| Open | A service is accepting connections |
| Closed | No application is listening |
| Filtered | Traffic is blocked by a firewall or security device |
Ports and Firewalls
Firewalls control which ports are allowed to receive or send network traffic. By permitting only required ports and blocking unnecessary ones, firewalls reduce the attack surface and help protect systems from unauthorized access.
Port Forwarding
Port forwarding allows traffic arriving on a router's public IP address and a specific port to be redirected to a device inside a private network. This technique is commonly used for self-hosted websites, game servers, remote desktop services and security cameras.
Port Scanning
Port scanning is the process of checking which ports on a device are open, closed or filtered. Network administrators use port scanning to verify configurations, while security professionals use it to identify exposed services that may require additional protection.
- Verify running network services.
- Identify unnecessary open ports.
- Test firewall configurations.
- Audit server security.
- Troubleshoot connectivity issues.
Common Mistakes
Network ports are simple in concept, but they are frequently misunderstood. Many connectivity problems occur because of incorrect assumptions about how ports, firewalls and network protocols interact. Understanding the role of ports helps diagnose communication issues more effectively.
- Confusing port numbers with IP addresses.
- Assuming TCP and UDP share the same connection state.
- Opening more ports than necessary.
- Ignoring firewall rules when troubleshooting.
- Assuming a service is available simply because the server is online.
- Believing that changing a port number provides strong security.
Best Practices
- Open only the ports required by your applications.
- Use encrypted protocols such as HTTPS and SSH whenever possible.
- Regularly audit open ports on Internet-facing systems.
- Restrict access using firewall rules and network segmentation.
- Disable unused services to reduce the attack surface.
- Document custom port assignments for easier maintenance.
Frequently Asked Questions
How many network ports are available?
Both TCP and UDP use 16-bit port numbers, providing 65,536 possible ports ranging from 0 to 65535.
Can TCP and UDP use the same port number?
Yes. TCP and UDP maintain separate port spaces, so the same port number can be used simultaneously by different services using different transport protocols.
What is an ephemeral port?
An ephemeral port is a temporary port automatically assigned by the operating system to a client application when it establishes an outbound network connection.
Why is port 443 used for HTTPS?
Port 443 is the standardized port assigned to HTTPS, allowing web browsers and servers to establish encrypted TLS connections using a well-known endpoint.
Does changing a service to another port improve security?
Changing a port may reduce casual scanning, but it should not be considered a primary security measure. Strong authentication, encryption, firewalls and regular software updates provide far more effective protection.
Helpful Network Tools
A Port Number Lookup identifies the service commonly associated with a specific port, an HTTP Port Reference provides information about ports used by web technologies, an HTTP Status Codes Lookup explains server response codes encountered during web communication, a Ping Command Builder generates platform-specific ping commands for connectivity testing, and an SSH Config Generator helps create SSH client configuration files for secure remote access.
Conclusion
Network ports enable multiple applications to communicate over the same device by directing traffic to the appropriate service. Combined with IP addresses and transport protocols such as TCP and UDP, ports form the foundation of Internet communication. Understanding common port numbers, firewall behavior and the distinction between client and server ports makes it easier to configure services, troubleshoot connectivity problems and secure networked systems effectively.