Well-known ports

On this page 7

Well-known ports are the TCP and UDP port numbers from 0 to 1023, which the Internet Assigned Numbers Authority (IANA) reserves for widely used standard services such as web servers, name resolution and remote login. Among transport protocols they form the lowest of three port ranges and act as a public convention: a client that wants to reach a web server on a host knows, without asking, that it should try port 80 or 443.

The convention matters because a transport connection is identified by addresses and ports on both ends. The client picks a temporary port for itself, but it must already know the server port. Well-known ports remove that guesswork for the most important services in Networking, and they also influence firewall rules, operating system privileges and traffic classification.

How well-known ports identify services

A port number is a 16-bit field in the TCP and UDP headers, so it ranges from 0 to 65535. Together with the IP address and protocol, it identifies one endpoint of a conversation, and the full five-tuple of source address, source port, destination address, destination port and protocol identifies the conversation itself.

A server application binds to a fixed port and listens. A client sends its first segment or datagram to that port from a temporary ephemeral port chosen by its operating system. Replies travel back with the two ports swapped. Because the server side is predictable and the client side is not, thousands of clients can talk to one service on a single well-known port at the same time.

IANA divides the space into three ranges with distinct purposes, summarized in the following table.

RangeNumbersAssignmentTypical use
Well-known (system) ports0-1023IANA through standards action or reviewCore internet services
Registered (user) ports1024-49151IANA on application by vendorsDatabases, applications, games
Dynamic or private ports49152-65535Never assignedEphemeral client ports
The three IANA port ranges

Common well-known ports and their services

A small set of well-known ports carries most everyday internet traffic, and network engineers recognize them on sight. Most assignments cover both TCP and UDP for the same service, even when the protocol in practice uses only one of them, so the registry stays consistent if the service later adopts the other transport.

PortTransportServiceNotes
20 and 21TCPFTP data and controlLegacy, sends credentials in clear text
22TCPSSHEncrypted remote login and file transfer
25TCPSMTPMail relay between servers
53UDP and TCPDNSTCP for large replies and zone transfers
67 and 68UDPDHCP server and clientUses broadcast during address assignment
80TCPHTTPUnencrypted web traffic
123UDPNTPTime synchronization
443TCP and UDPHTTPSUDP carries HTTP/3 over QUIC
Frequently encountered well-known ports

Port 0 is reserved and is not used on the wire. In programming interfaces, binding to port 0 is a request for the operating system to choose any free ephemeral port, which is why it appears in code but should never appear as a real destination in captured traffic.

Privileges and operating system behavior

On Unix-like systems, ports below 1024 are traditionally privileged ports: only a process with administrative rights can bind to them. The rule dates from a time when a connection from a low port suggested that a trusted administrator controlled the remote service, an assumption that no longer provides real security on modern networks.

Today the restriction mainly prevents an ordinary user from impersonating a system service on a shared machine. Linux allows a specific binary to receive the capability to bind low ports without full root rights, and the threshold itself can be adjusted. Windows does not enforce a privileged range in the same way, so access control there relies on firewall rules and service accounts.

PlatformDefault rule for ports below 1024Common workaround
LinuxRoot or a granted capability requiredGrant the capability or use a socket-activated service
BSD and macOSRoot traditionally requiredRun a privileged launcher that hands over the socket
WindowsNo privileged range enforcedRestrict with firewall rules and service accounts
ContainersDepends on runtime settingsMap an internal high port to an external low one
Low port handling by platform

Well-known ports compared with registered and ephemeral ports

Well-known ports describe what a server offers, while ephemeral ports describe where a client is temporarily reachable. Registered ports sit in between: they also identify services, but those services are application-specific rather than fundamental internet protocols, such as database listeners or remote desktop.

The distinction has practical consequences. A stateful firewall usually opens inbound access for a handful of well-known ports and relies on connection tracking for the ephemeral replies. Port address translation on routers rewrites client ports from the ephemeral range, but it almost never rewrites a well-known destination port, because clients would otherwise fail to find the service.

  • A port assignment is a convention, not an enforcement mechanism; any service can listen on any free port.
  • The same number can carry different services on TCP and UDP, although IANA prefers to keep them aligned.
  • Secure variants often received separate numbers, for example 443 for HTTPS and 993 for IMAP over TLS.

Security implications and common misconceptions

Because well-known ports are public knowledge, they are the first targets of automated scanning. Any host exposed to the internet with port 22 or 3389 open receives login attempts within minutes. Effective defense relies on strong authentication, patching and access control, not on hiding the service.

Moving a service to a non-standard port reduces log noise from opportunistic scans, but it is not protection; a full scan finds it quickly. Similarly, identifying an application by port number alone is unreliable, because tunneling tools and malware deliberately use port 443 to blend in with normal encrypted web traffic.

BeliefRealityBetter practice
Port 443 always means HTTPSAny protocol can run on itInspect protocol behavior, not only the port
A changed port hides a serviceScanners test all 65535 portsRely on authentication and allow lists
Low ports are trustworthyPrivilege rules apply only locallyAuthenticate peers cryptographically
Blocking a port stops an applicationMany applications fall back to 443Combine port rules with application controls
Misconceptions about well-known ports

Stripped to the essentials

Think of a computer as a large office building with one street address and thousands of numbered doors. The address gets a message to the building, and the door number decides which department receives it.

Well-known ports are the door numbers everyone agreed on in advance. Web pages are served at door 443, name lookups at door 53, secure remote login at door 22. Because the numbers are shared knowledge, any computer in the world can knock on the right door without asking first. The agreement is a convenience, not a lock: anyone can still choose a different door, and attackers know the standard numbers too.

Where it is applied

A small accounting firm moves its client portal to a cloud virtual server. The administrator configures the provider’s security group to allow inbound TCP 443 from anywhere for the portal and TCP 22 only from the office IP address for maintenance, and blocks every other inbound port.

Within an hour of launch, the server log records hundreds of login attempts on port 22 from unknown addresses, all rejected by the firewall rule before reaching SSH. Meanwhile, clients reach the portal by typing only the domain name, because their browsers assume port 443 for HTTPS and never need the number spelled out.

Later, a developer wants to run a test version of the web application. Instead of opening another low port, the test service listens on a registered port above 1024 that is reachable only through the office VPN, so the public attack surface stays at a single port while the team keeps a convenient test environment.