A port is a numbered channel on a computer that lets a single machine run many network services side by side without them getting tangled. An IP address gets data to the right computer; the port number gets it to the right program on that computer. Web traffic, email, and a database can all share one IP address because each listens on its own port. In 2026 the concept is unchanged from decades past, which is exactly why it is worth understanding clearly: ports are everywhere, from your local development server to every cloud firewall rule.
What a port actually is
A port is just a number, from 0 to 65535, that labels one endpoint of a network connection. When a program wants to receive network traffic, it asks the operating system to listen on a specific port. Anything arriving for that port is handed to that program.
The pairing is the key idea. The combination of an IP address and a port uniquely identifies a service on the network. You will often see this written as address:port, for example 127.0.0.1:8080.
-- A local web server listening on port 8080
curl http://localhost:8080/health
How an address and a port work together
Think of the IP address as a building and the port as a numbered door. Many doors share one building, and each leads to a different service inside.
| Layer |
Job |
Analogy |
| IP address |
Finds the right machine |
The street address of a building |
| Port |
Finds the right service |
A specific door or suite number |
| Protocol (TCP/UDP) |
Defines how data flows |
Whether you knock or shout through |
When your browser loads a site, it connects to the server IP on port 443 by default for secure traffic. The server is listening there, so the connection lands at its web service rather than its mail service or database.
Common port numbers
| Port |
Service |
Notes |
| 80 |
HTTP |
Plain web traffic |
| 443 |
HTTPS |
Encrypted web traffic, the modern default |
| 22 |
SSH |
Secure remote shell access |
| 5432 |
PostgreSQL |
A common database default |
| 3000 / 8080 |
Dev servers |
Frequent local development choices |
Ports 0 to 1023 are well-known and reserved for standard services. Ports above that are available for your own applications. You do not need to memorize the full list, but knowing 80, 443, and 22 will cover most everyday situations. Controlling which ports are reachable is exactly what a firewall does.
How to think about ports in practice
- Pick a free local port for development. Tools default to ones like 3000 or 8080; if it is taken, choose another.
- Open only the ports you need on a server. A firewall that blocks everything except 443 and 22 is a strong default.
- Use port forwarding to reach a service behind a router. This maps an external port to an internal machine and port.
- Watch for conflicts. Two programs cannot listen on the same port at once; the second will fail to start.
Common mistakes
- Exposing a database port to the internet. A database on a public port is a frequent breach cause. Keep it on a private network.
- Confusing a port with a protocol. TCP and UDP can both use the same port number for different traffic; the port alone does not define the protocol.
- Hard-coding a port that may be taken. Make development ports configurable so a conflict does not block teammates.
- Forgetting the firewall. A service can be running fine yet unreachable simply because its port is closed.
FAQ
How many ports does a computer have?
There are 65,536 port numbers, from 0 to 65535. They are a numbering scheme, not physical hardware, so they all exist on every machine.
What is the difference between a port and an IP address?
The IP address identifies the machine; the port identifies the service on that machine. You need both to reach a specific program.
Why is HTTPS on port 443?
It is a long-standing convention. Browsers default to 443 for encrypted web traffic so you do not have to type it. Servers listen there to match.
Can two programs use the same port?
Not at the same time on the same address and protocol. The first one to bind the port holds it; a second attempt fails until the first releases it.
Where to go next
See what a server is in 2026, what an IP address is in 2026, and what localhost is in 2026.