A firewall wizard asks which ports to allow. A port scan of your server lists half a dozen numbers you do not recognise. A game guide says to "forward UDP 19132", and an email client refuses to send until you change 25 to 587. Ports appear constantly in networking tasks, and the numbers only mean something if you know the conventions behind them.
This guide explains what a port is, how TCP and UDP ports differ, how port numbers are organised, the ones worth knowing by heart, and how to think about ports when you configure firewalls and port forwarding.
What a port is
An IP address gets data to the right machine. A port number gets it to the right program on that machine. A server can run a web server, a mail server and SSH at the same address because each listens on a different port.
Port numbers are 16-bit, so they range from 0 to 65535. A connection is identified by the combination of protocol, source address and port, and destination address and port. When your browser connects to a website, the destination is typically port 443, and your computer picks a temporary source port for the reply to come back to.
TCP versus UDP
Ports exist separately for the two main transport protocols:
| TCP | UDP | |
|---|---|---|
| Connection | Established with a handshake | None; independent datagrams |
| Delivery | Reliable, ordered, retransmitted | Best effort; no guarantee |
| Typical uses | Web, email, SSH, file transfer, databases | DNS queries, voice, video, games, VPNs |
TCP port 53 and UDP port 53 are different endpoints. Many services use one protocol; some, like DNS, use both.
The IANA ranges
The Internet Assigned Numbers Authority (IANA) divides the port space into three ranges:
| Range | Name | Use |
|---|---|---|
| 0-1023 | Well-known (system) ports | Core services such as HTTP, HTTPS, SSH, DNS |
| 1024-49151 | Registered ports | Assigned to specific applications on request |
| 49152-65535 | Dynamic / private (ephemeral) | Temporary client-side ports |
On most Unix-like systems, only privileged users can run services on well-known ports. Note that operating systems choose their own ephemeral range, which may not match the IANA one exactly.
Ports every administrator should know
| Port | Protocol | Service |
|---|---|---|
| 20, 21 | TCP | FTP (unencrypted) |
| 22 | TCP | SSH and SFTP |
| 23 | TCP | Telnet (unencrypted, avoid) |
| 25 | TCP | SMTP between mail servers |
| 53 | UDP/TCP | DNS |
| 80 | TCP | HTTP |
| 110 / 995 | TCP | POP3 / POP3 over TLS |
| 143 / 993 | TCP | IMAP / IMAP over TLS |
| 443 | TCP (and UDP for HTTP/3) | HTTPS |
| 445 | TCP | SMB file sharing |
| 465 / 587 | TCP | Mail submission (implicit TLS / STARTTLS) |
| 3306 | TCP | MySQL / MariaDB |
| 3389 | TCP | Remote Desktop (RDP) |
| 5432 | TCP | PostgreSQL |
| 6379 | TCP | Redis |
| 8080 | TCP | Common alternative HTTP port |
The encrypted versions of older protocols usually have their own ports (993 for IMAP over TLS, 995 for POP3 over TLS), while newer designs often upgrade the same connection (STARTTLS on 587).
Look up a port quickly
The Port Numbers Reference lists about 150 common TCP and UDP ports and works entirely offline.
- Type a number or a service name into the search box, for example
3389,ssh,databaseorvpn. Searching80also surfaces related ports such as 8080 and 8000. - Narrow the list with a category chip, such as database, remote access, email or gaming.
- Use the Protocol buttons to show TCP-only or UDP-only entries.
- Read the Service, Protocol and Description columns. A lock icon marks services encrypted by default, and the notes call out ports that should never be exposed to the internet.
- Click the copy icon to copy a port number into a firewall rule or ticket.
If you search for a number that is not listed, the tool tells you which IANA range it falls in, which helps judge whether it is a registered service or a temporary client port.
Ports and security
An open port is a program waiting for connections. Every one you expose to the internet is something an attacker can probe. Services that should normally sit behind a VPN or an allow-list include:
- RDP (3389), SMB (445) and Telnet (23), which are frequently targeted;
- databases such as MySQL (3306), PostgreSQL (5432), MongoDB (27017) and Redis (6379);
- container and admin APIs such as the unencrypted Docker API (2375).
A practical approach for servers is to deny everything inbound by default and allow only what is needed, for example 443 (and 80 for redirects) for a web server, and SSH only from your office address. When writing allow-list rules for a whole network, the IP Subnet Calculator turns a range into correct CIDR notation, and you can find your own current public address with What Is My IP.
A port number does not prove the service
Port numbers are conventions, not rules. Anything can listen on any port: SSH on 2222, a web admin panel on 8443, or malware on 443. Scanners identify services by talking to them, not just by number.
Checking which ports are in use
- Windows:
netstat -anolists connections and listening ports with process IDs; PowerShell'sGet-NetTCPConnection -State Listendoes the same for TCP. - macOS:
lsof -i -P -n | grep LISTEN. - Linux:
ss -tulpnshows listening TCP and UDP ports with the owning program. - From outside: a port scanner such as nmap, run only against systems you are authorised to test.
Reachability problems are not always about ports. If a server answers slowly rather than refusing connections, measure latency with the Ping Test; if it answers with an error, HTTP status codes explained covers what the response means.
Port forwarding in brief
Home routers use NAT, so incoming connections do not reach devices inside the network unless you forward a port: "send anything arriving on UDP 25565 to 192.168.1.40". Forward only what the application documents, to a device with a fixed local address, and remove the rule when you no longer need it. If your ISP uses carrier-grade NAT, port forwarding will not work at all, because you do not have your own public IPv4 address.
Frequently asked questions
What is the difference between TCP and UDP ports?
TCP provides reliable, ordered connections and suits web, email and file transfer. UDP sends independent packets without delivery guarantees, which suits DNS, voice, video and games. The same number can host different services on each.
What are well-known ports?
Ports 0 to 1023, assigned by IANA to core services such as HTTP (80), HTTPS (443) and SSH (22).
Which port does RDP use?
Remote Desktop uses TCP 3389 by default (newer versions can also use UDP 3389). It should not be exposed directly to the internet; use a VPN or gateway.
Which email ports should my client use?
Submit mail on 587 (STARTTLS) or 465 (implicit TLS), and read mail on 993 for IMAP or 995 for POP3. Port 25 is for server-to-server delivery and is often blocked by ISPs for home users.
Is changing a service's port a security measure?
It reduces automated noise in logs but does not stop a determined attacker, since scanners detect services on any port. Use firewalls, strong authentication and updates as the real protection.