Common ports worth knowing
The port numbers that tell you which service is listening — memorize these and half of networking clicks.
A port is a numbered doorway on a machine that lets one IP address host many services at once. Well-known ports (0–1023) are reserved for standard services: 80/443 for web, 22 for SSH, 53 for DNS, 25 for SMTP, 20/21 for FTP, and 3389 for RDP. Databases use higher registered ports — 3306 MySQL, 5432 Postgres, 6379 Redis, 27017 MongoDB. Knowing them speeds up debugging, firewall rules and threat-spotting.
Web — 80 and 443
Port 80 is HTTP and port 443 is HTTPS (HTTP secured with TLS), and between them they carry almost all web traffic. When you type a URL with no port, the browser assumes 443 for https:// and 80 for http://. These are the two numbers to know cold, because virtually every web request lands on one of them.
Remote access — 22 and 3389
Port 22 is SSH, the encrypted remote command line used to administer Linux servers, and it also carries SFTP for secure file transfer. Port 3389 is RDP (Remote Desktop Protocol), which gives a full graphical Windows desktop over the network. Both are prime targets for attackers, so they're usually locked down to trusted IPs.
File transfer — 20 and 21
FTP uniquely uses two ports: 21 is the control channel that carries commands and logins, while 20 is the data channel that transfers the actual file contents. Because FTP sends credentials in the clear it's considered insecure, which is why SFTP over port 22 has largely replaced it. Seeing 20/21 open is often a sign of legacy infrastructure.
Infrastructure — 53 and 25
Port 53 is DNS, the name-to-IP lookup service that nearly every other connection depends on, and it runs over both UDP (fast queries) and TCP (larger transfers). Port 25 is SMTP, the protocol mail servers use to relay email between each other. Both are foundational plumbing you rarely touch directly but that everything else relies on.
SQL databases — 3306 and 5432
Port 3306 is MySQL and port 5432 is PostgreSQL, the two most common relational databases. These live in the higher 'registered' port range rather than the well-known range, but they're so ubiquitous that engineers know them by heart. Crucially, database ports should almost never be exposed to the public internet — only to the application servers that need them.
NoSQL stores — 6379 and 27017
Port 6379 is Redis, the in-memory cache and key-value store, and port 27017 is MongoDB, the document database. Like the SQL ports, these are registered ports every backend engineer recognizes, and the same rule applies: keep them behind the firewall. An open Redis or MongoDB port on the public internet is a classic, frequently-exploited misconfiguration.
What a port actually is
An IP address gets a packet to the right *machine*, but a single machine runs many programs that all want to use the network at once — a web server, an SSH daemon, a database, a mail server. A port is how the operating system tells them apart. It's a 16-bit number (0 to 65535) attached to a connection, and together an IP address plus a port ("192.0.2.10:443") uniquely identifies one endpoint of one conversation. The transport layer — TCP and UDP — carries these port numbers in every packet, and the OS uses them to hand incoming data to the correct program.
The useful analogy is a large office building. The IP address is the street address that gets mail to the building; the port number is the office or extension that gets it to the right team inside. Because there are 65,536 possible ports, one server can host thousands of distinct services simultaneously without confusion. When a client wants a web page, it doesn't just connect to the server's IP — it connects to that IP *on port 443*, and the server's web software is the one listening there. This is why "which port?" is one of the first questions in any networking or debugging conversation.
Well-known, registered, and ephemeral ranges
Not all ports are equal. The range is divided by convention (governed by IANA, the Internet Assigned Numbers Authority) into three bands:
- Well-known ports (0–1023) are reserved for standard, widely-used services. This is where HTTP (80), HTTPS (443), SSH (22), DNS (53), SMTP (25) and FTP (20/21) live. On most systems, binding to a port in this range requires administrator/root privileges, which is a small security measure — it stops an unprivileged program from impersonating a system service.
- Registered ports (1024–49151) are assigned to specific applications but with looser control. Databases sit here: MySQL (3306), PostgreSQL (5432), Redis (6379), MongoDB (27017), as does RDP (3389).
- Ephemeral / dynamic ports (49152–65535) are the temporary ports the OS hands out to the *client* side of a connection. When your browser connects to a server's port 443, your own machine picks a random high port as the return address for that specific connection.
Understanding these bands explains a lot: why standard services always land on the same low numbers, and why the "source port" of your outbound connections looks random.
The ports you truly need to know
A handful of ports come up so often that memorizing them pays off daily. Grouped by role:
- Web —
80HTTP and443HTTPS. The two most common ports on the internet; 443 is HTTP wrapped in TLS. A browser defaults to these when a URL omits the port. - Remote access —
22SSH (encrypted remote shell, and the transport for SFTP) and3389RDP (graphical Windows Remote Desktop). Both grant control of a machine, so they're high-value targets and should be firewalled to known sources. - File transfer —
21FTP control and20FTP data. FTP is unencrypted and largely legacy; SFTP over 22 is the modern secure choice. - Core infrastructure —
53DNS (name resolution, over UDP and TCP) and25SMTP (server-to-server mail relay). - Relational databases —
3306MySQL and5432PostgreSQL. - NoSQL / cache —
6379Redis and27017MongoDB.
You don't need the entire IANA registry in your head, but this dozen covers the overwhelming majority of what you'll meet building and running systems.
Why ports matter for security and firewalls
Ports aren't just trivia — they're central to how you secure a system. A firewall's core job is deciding which ports may be reached and from where. The standard posture is default-deny: block everything, then open only the specific ports a service genuinely needs. A public web server might expose only 80 and 443 to the world; SSH on 22 might be allowed only from your office or VPN; and the database ports should be reachable *only* from the application servers, never from the open internet.
This last point is one of the most common and damaging real-world mistakes. Leaving a database port — Redis on 6379, MongoDB on 27017, Postgres on 5432 — open to the public internet has led to countless breaches, because those services were historically designed to trust their network and often shipped with weak or no authentication. Attackers constantly scan the entire internet for open ports, and an exposed database is found within minutes. The corollary is that open ports are your attack surface: every listening port is a door someone might try. Security tools like nmap scan for open ports precisely because knowing what's listening tells you what can be attacked.
Ports in practice: debugging and daily use
Beyond security, knowing ports makes you faster at diagnosis. When something can't connect, the questions are immediate and concrete: is the service actually *listening* on the expected port? Is a firewall blocking it? Is something else already using it? Commands like netstat, ss, and lsof -i list which ports are open and which process owns each one; telnet host 443 or nc -zv host 5432 test whether a port is reachable from where you are. A "connection refused" usually means nothing is listening on that port, while a "connection timed out" more often means a firewall silently dropped the attempt — two different problems the port tells you apart.
Ports also shape everyday configuration. Running two web apps on one machine? Put one on 8080 and the other on 8081 behind a reverse proxy. Local development constantly juggles ports — 3000 for a Node app, 5432 for a local Postgres, 6379 for Redis — and "port already in use" is a rite of passage. The through-line is simple: an IP address answers *which machine*, and a port answers *which service on it*. Internalize the common port numbers and a huge amount of networking, firewalling and debugging stops being mysterious and becomes a matter of checking the right door.
A port is a 16-bit number identifying a specific service on a host, so one IP can run many services.
Well-known ports (0–1023) are reserved for standard protocols; higher ranges are registered or ephemeral.
Web: 80 = HTTP, 443 = HTTPS (TLS). These are the two you'll see most.
Remote access: 22 = SSH (also SFTP), 3389 = RDP for Windows remote desktop.
Infrastructure: 53 = DNS, 25 = SMTP mail, 20/21 = FTP data/control.
Databases: 3306 MySQL, 5432 Postgres, 6379 Redis, 27017 MongoDB.
Quick quiz
A service is listening on port 443. What is it almost certainly?
Why should ports like 5432 (Postgres) and 6379 (Redis) not be exposed to the public internet?
Common network protocols every engineer should know
The dozen protocols that quietly carry every request you make, sorted by the layer they live on.
What is a firewall
The gatekeeper that decides which packets are allowed to cross a network boundary.
PostgreSQL 101
The relational database that quietly became everyone's default.
Redis vs Memcached
Two in-memory key-value stores — one a lean cache, one a data-structure server.