HTTP Port
In this guide, we'll aim to explain everything you need to know about the HTTP port as you go forward in your networking journey!
IP addresses
When we discuss networking, IP address are often brought up. This is a sequence of numbers separated by dots that identify your computer to the world. Your computer has a public IP address that's visible to the Internet. Additionally, it has a private IP address that is only visible to other machines on your Local Area Network (LAN).
Consider how many Internet-connected applications you use. For example, you probably are reading this right now in your web browser, you may have a mail client running, and countless other networked applications. This is where ports become important in networking.
Why use the HTTP port?
You can probably see the issue without using ports: we'd have all sorts of traffic flying around without a definitive destination. You can think of ports as virtual windows and your IP address as a building. Each port is designed to receive data of a specific format for a particular protocol.
This is how you're able to run several applications connected to the Internet at the same time. Most popular protocols have reserved ports for themselves. For example, the HTTP port is always port 80
. These are always reserved for common protocols. If a developer makes an application utilize these ports for other purposes in their own applications, they run the risk of network communications failure.
UDP vs TCP ports
Before we dive into the list of reserved ports, there's one more difference you'll need to understand; this is the difference between UDP and TCP ports. User Datagram Protocol, also known as UDP, is used when there's a huge amount of data to send, but it isn't a big deal if a small amount of that data is missed by the recipient. Online streaming services often stream over UDP because much more data can be sent, but the recipient never verifies it got the data.
On the other hand, Transmission Control Protocol focuses on ensuring that the recipient gets every piece of data, also called packets. This protocol is used when every bit of data matters; for example, email uses this to ensure that the contents of messages is always verifiable. The client always acknowledges receipt of every single packet, and transmission of failed packets is always retried until it succeeds. While this is a slower way to transmit data, it's guaranteed that the sender will know whether or not data was sent.
This is why you'll see (TCP), (UDP), or (TCP/UDP) after each reserved port listing. This means that it can be used over either TCP or UDP. Note that the most modern version of HTTP, HTTP/3, is built on top of solely UDP in order to increase its speed, so our HTTP Port on modern devices will be UDP, but technically the port could operate on either TCP or UDP.
Our list only contains commonly utilized ports. Many low-numbered ports are still technically reserved but are not in common usage anymore. For example, port 8
used to be reserved for the quote of the day before Internet connections were common. However, now even most networking students would likely not be familiar with that port off-hand, and that's completely fine!
Common ports, registered ports, and more
Generally speaking, ports numbered anywhere from 0
to 1023
are commonly known, reserved ports. That means that they've been used for the same program, protocol, or service for quite awhile. For example, as HTTP has been around for awhile, it's simply port 80
. Likewise, the secure version, HTTPS, is on port 443
.
Ports numbered between 1024
and 49151
are called registered ports. This means that there is an official usage for most ports in this range. However, it's less likely that these ports would be in usage on the average user's machine than commonly known ports. They're usually for specialized purposes and more likely to be used on corporate machines. Still, if you're developing an application, you should not use these ports for anything other than their "registered" purposes.
Finally, we have unreserved ports. These run from 49152
through 65535
. These aren't registered nor are they commonly used. Some textbooks and sites refer to these as ephemeral ports because they're often temporarily utilized by applications to transfer data.
Why do port numbers end with 65535
? They are technically 16-bit numbers. Since a bit is binary and can have a 0
or 1
value, there are two possible values for each bit in a sequence. To calculate the number of available ports, we would just count 2 to the sixteenth power (multiply the number 2 by itself 16 times). However, because ports are zero-indexed (they start with the number 0
rather than 1
), we subtract 1. This works out to be 65535
.
The most important ports to know
The HTTP port isn't the only common, reserved port! It's crucial to know these common ports that are always reserved, especially if you'll be working in the networking arena. Remember, (almost) all of these will be somewhere between 0
and 1023
!
Remember to also not use registered ports for customized purposes. IANA is the agency that determines when a port is considered common or registered. Its documentation is a bit dense, but it's the most complete and authoritative publication on the subject of the HTTP port and others.
- SSH Port
22
(TCP) - This is an old but still used mechanism to securely transfer files from one machine to another. To guarantee integrity, this must use TCP. - SMTP Port
25
(TCP) - This is how mail servers receive and send mail among each other. - DNS Port
53
(TCP/UDP) - The Domain Name System (DNS) is what resolves domain names to IP addresses. Though you remember network addresses as names such as "google.com", it's DNS servers that work to determine the exact IP address to which top-level domains correspond. - HTTP Port
80
(TCP) - This is the server port your computer accesses when you go to a website without HTTPS protections. - HTTPS Port
443
(TCP) - This is the port that you access on a server when you go to a web address that starts withhttps://
rather than justhttp://
. It uses Transport Layer Security (TLS) technology to ensure that information transmitted while connected is kept secure.
Keep in mind that this is by no means an exhaustive list. Now, let's take a look at how a connection to a server's HTTP port actually occurs!
Navigating an HTTP port connection
First, your computer needs to have a private port of its own. This is the port used to connect to port 80
on a remote server. This is typically a randomized ephemeral port. It's not visible to anyone but you.
Once your device comes up with an internal port to utilize, it sends what's called a SYN Packet to the HTTP server over port 80
. If all is well with the connection, the HTTP port sends back what's called an ACK packet. This is to acknowledge that the initial packet was received and let you know that the server is ready to proceed.
Next, your computer sends over a SYN ACK packet from your internal port to the HTTP port on the remote server. This finalizes the initial handshake performed. Both servers are on the same page in terms of your client connectivity, and you're ready to browse the site!