Last updated
What Are Port Numbers?
Port numbers are 16-bit unsigned integers (0–65535) used by TCP and UDP to identify specific processes or services on a host. When a packet arrives at a server, the OS uses the destination port number to route it to the correct application. Port numbers are divided into three ranges by IANA (Internet Assigned Numbers Authority).
Port Number Ranges
| Range | Name | Description |
|---|---|---|
| 0–1023 | Well-known ports | Assigned to common services (HTTP, FTP, SSH). Require root/admin to bind. |
| 1024–49151 | Registered ports | Registered with IANA for specific applications. No root required. |
| 49152–65535 | Dynamic/ephemeral | Used by OS for outgoing connections. Not assigned to services. |
Common Well-Known Ports
| Port | Protocol | Service |
|---|---|---|
| 20, 21 | TCP | FTP (data, control) |
| 22 | TCP | SSH |
| 25 | TCP | SMTP (email sending) |
| 53 | TCP/UDP | DNS |
| 80 | TCP | HTTP |
| 110 | TCP | POP3 |
| 143 | TCP | IMAP |
| 443 | TCP | HTTPS |
| 3306 | TCP | MySQL |
| 5432 | TCP | PostgreSQL |
| 6379 | TCP | Redis |
| 27017 | TCP | MongoDB |
Checking Open Ports
Bash
# List all listening ports (Linux/macOS)
ss -tlnp
# or
netstat -tlnp
# Check if a specific port is open
nc -zv localhost 8080
# Windows
netstat -ano | findstr :8080