Every computer on a network has an address. That address tells other computers where to find it, in the same way a street address tells a visitor which building to walk towards. But a building usually has more than one door, and a computer usually runs more than one service. The address alone is not enough.
That something is a port. A port is a number, from 0 to 65,535, attached to a network address. Together, the address and the port point to one specific service on one specific machine. The address finds the computer. The port finds the service waiting inside it.
Think of a large building with a single street address and many numbered doors. Behind one door sits a web service, ready to hand out pages. A visitor who arrives at the right building but the wrong door will not get what they came for, even though the address was correct.
What a port actually is
A port is not a physical socket on the back of a computer. You cannot point to it or unplug it. It is a logical number, part of the way network software organises traffic. When a program wants to receive connections, it asks the operating system to listen on a particular port. From then on, any message addressed to that port is passed to that program.
The number is the whole mechanism. The sender writes the destination address and the destination port on the message, and the receiving computer uses the port number to decide which waiting program should get it.
This is why a single machine can do many jobs at once without confusion. A server can serve web pages, receive mail, and share files at the same time, because each service listens on its own port. The traffic arrives at the same address, then splits by number, each stream going to the service that asked for it.

The address and the number, together
An address without a port is an unfinished direction. It says where to go, but not who to ask for once you arrive. A port without an address is just as incomplete. It says which service you want, but not which machine runs it. Only the pair is a complete destination.
You can see the pair in everyday use, even if the port is usually hidden. A web address normally leaves the port out, because browsers fill in the usual number on their own: port 80 for an unencrypted web connection, and port 443 for an encrypted one. When a service uses a less common port, the number appears after the address, separated by a colon, as in example.com:8080.
How a request finds the right door
A connection begins with a knock. The sending computer writes a message to the destination address and port, and the network carries it to the machine. The receiving computer looks at the port number and hands the message to the program listening there. If that program accepts, the two sides can then exchange messages back and forth.
The reply needs a port of its own. The sender also picks a temporary port, called an ephemeral port, for its side of the conversation. That number is usually high, chosen from the upper part of the range, and used only for that one connection.
None of this requires the user to think about ports at all. Browsers, mail apps, and chat apps choose the numbers for you, using the standard port for the service you are reaching. You only meet ports directly when something is set up by hand: a small home server, a development tool running on your own machine, or a service that lives on an unusual port. Then getting the number wrong is the most common reason a connection fails.
Well-known numbers, and the rest
Ports are divided, by convention, into ranges. Ports from 0 to 1,023 are called well-known ports. They belong to the oldest and most widely used services, and they are the same almost everywhere. Port 80 is the web without encryption. Port 443 is the web with encryption. Port 53 is used by the system that turns names into addresses.
Ports from 1,024 to 49,151 are registered ports, set aside for particular applications. Ports from 49,152 to 65,535 are dynamic ports, the pool from which temporary ports are drawn. These ranges are conventions, not laws of physics. A service can listen on almost any port its owner chooses. The number matters, but it is chosen, not fixed by the service itself.

Why the number matters as much as the address
The address and the port answer two different questions, and a connection needs both answers to be right. Get the address wrong, and the message goes to the wrong machine. Get the port wrong, and the message reaches the right machine but the wrong service, or no service at all.
This also explains a common kind of confusion. A website can be running perfectly well, and still seem unreachable, because the visitor is knocking on a port where nothing is listening. The service is alive, the machine is online, and the address is correct. Only the number is wrong, and that is enough. The fix is not to restart the service, but to check which port the service is actually listening on, and which port the visitor is actually using.
Open, closed, and listening
People often talk about ports as open or closed. An open port is one where a service is listening and ready to accept a connection. A closed port is one where nothing is listening, so a connection attempt is refused or goes unanswered. A firewall sits between the outside world and these ports, deciding which knocks are allowed through and which are turned away.
Closing a port you do not need is a quiet, practical habit. A webhook that never arrives is often a port problem rather than a problem with the service itself: the message was sent, but it knocked on a door that was shut, or on a door behind which nothing was waiting.

A small number with a large job
Most of the time, ports stay out of sight, and that is how it should be. You visit a website, and the browser uses port 443. A websocket connection, which stays open so messages can flow both ways, begins with a request to a port, just like any other connection, and then keeps that door open for the conversation that follows.
A port is a small idea. It is a number, nothing more, attached to an address. But it does a large job: it lets one machine run many services, lets many conversations happen at once without confusion, and lets a visitor ask for exactly the service they need, rather than merely arriving at the right building. The next time a connection fails, and the address looks right, it is worth asking the simplest question of all. Which door did you knock on?
