What is a Port Number? Types, Working, Examples

what is port number

Ever wondered how you can scroll through your favorite fitness videos, send emails, and do online banking all at once, without everything turning into a chaotic digital mess? It’s all because of the numeric maestros of the networking world- Port Numbers. Didn’t know what these are? Well, there are over 65,000 ports available each with its own unique port number. Through this blog, we will be cracking the code of port numbers, and learning everything about them with examples. I will also explain how you can identify the active port numbers on your device. Let’s dive in! 

What is a Port Number in Networking?

A port number is a 16-digit number that acts as a unique identifier for a connection endpoint or a service running on a host. Let’s consider an example for easy understanding. 

working of ports

Suppose you have different services running on your computer like your email, web browser, instant chat app, etc. Now each service you use has its own port number. When you browse a website by typing the web address and hitting enter, your web browser sends a request to get access to the website using port number 80. Likewise, when you open your email client to send an email, it uses port 25 to send your message and as you refresh to check for new emails, the client uses port 110. Further, as you open your instant chat app to talk with a friend in real time, the app communicates using port 6667. 

So, each service you use has its own specific port number. When your device i.e. your computer sends or receives data, it knows which door to use based on the service you’re accessing. 

Insight: Port Numbers in networking are logical endpoints which is why they are often referred to as Logical Ports as well. 

Which Layer are Ports in the OSI Model?

ports in OSI model

The OSI model is a conceptual model that represents how network communications work. This model has 7 layers shown in the above image. Ports are associated with the Transport Layer i.e. Layer 4 of the OSI model. The Transport Layer primarily makes use of 2 protocols – TCP and UDP. These protocols are needed to specify which port a packet should go to. In the header section of TCP and UDP, the information about port numbers is defined. 

Difference Between IP Address and Port Number

In the context of networking, it is important to learn the difference between an IP address and a port number. It will help you understand how data is directed within a network. So let’s take a look:

An IP address identifies a machine in an IP network and is used to identify the destination address of a packet. On the other hand, a port number identifies a certain service or application on a system. 

What is a Proxy Server Address and a Port Number?

A Proxy Server Address is the IP address that identifies the location of the proxy server on the network. The below table dictates the difference between a Port Number, IP Address, and Proxy Server Address. 

The below table gives you a glance at the difference between a port number, IP address, and proxy server address.

difference between port number, IP address , proxy server address

How Did Port Numbers Come Into Existence?

In the early days of computer networking, the allocation of ports was done informally and on an ad-hoc basis. There needed to be central coordination. As the need for standardization grew, IANA i.e. Internet Assigned Numbers Authority took the responsibility to manage the allocation of port numbers. They introduced 3 defined categories of port numbers, designating a certain range of port numbers to each category. In the next section, I will explain the different types of port numbers along with their range. Have a look!

What are the Different Port Numbers?

different types of network ports

Logical ports are categorized into 3 main types which are:

  • Well Known Ports

These port numbers range from 0 to 1023. Well-known port numbers are specifically reserved for standard services. For example, Hyper Text Transfer Protocol i.e. HTTP uses port 80, FTP uses port 21, DNS uses port 53, etc. 

  • Registered Ports

The range for these ports is from 1024 to 49151. Registered ports are assigned by the Internet Assigned Number Authority (IANA) to specific services and applications that are not very common. 

  • Dynamic Ports

Dynamic Ports are also called Private Ports or Ephemeral Ports. The range for these ports is 49152 to 65535. These ports are used for short-lived or temporary connections. Also, these ports are not pre-assigned to any specific service. 

Now, we have learned about the different types of ports and the port ranges assigned to them. In the next section, let’s catch a glimpse of why these ports hold significant value in networking. 

Importance of Ports

For effective communication and functioning of various services, ports serve as essential elements. Here’s how:

  • Differentiation of Services

If ports aren’t there, then it would be difficult to identify and differentiate various services and applications running on the same device. As each application and service is assigned a unique port number, multiple services and applications can run concurrently without any interference.

  • Efficient Routing of Data

Port numbers work in conjunction with IP addresses to direct incoming data to the appropriate service or application based on the assigned port number. Thus adding to the efficiency of the routing process. 

  • Troubleshooting Network Issues

When diagnosing and troubleshooting network issues, it is important to understand which applications and services are involved. By understanding active port numbers, it becomes easy to figure out potential problems. 

  • Quality of Service

Priorities can be assigned to various port numbers to manage different types of traffic. This way network admins can ensure that critical applications receive high bandwidth and thus perform better. 

How do Ports Make Network Connections More Efficient?

There’s a variety of data that flows to and forth on a device from the same network. Now, we will understand how ports help a device/computer system to understand what to do with the data they receive. 

How do Ports Work in Networking?

Suppose Alex sends Emma a high-resolution image using the HTTP on port 80. Emma’s web browser listens for incoming data at port 80, processes it, and displays it. All this happens seamlessly. Simultaneously, Alex also shares a spreadsheet with Emma using FTP on port 21. Emma’s computer efficiently receives the file using the FTP service and stores it. Now comes a twist. Alex mistakenly tries to send a video file to Emma using SMTP on port 25. This port is typically reserved for email applications. If in case, Emma’s device receives the file and transfers it to the email application, then the email application will have no clue about what to do with the file. 

In short, each application on Emma’s computer is assigned to a unique port, ensuring that data received on that port is directed to the appropriate application capable of interpreting and processing it. 

Now, let’s take a look at different ways in which ports add to the efficiency of the network connections:

  • Standardized Communication

We know that every port number is assigned to a specific protocol or service. This enables standardized communication between applications on different platforms regardless of their underlying technology. For example, port 80 is used by HTTP, port 443 is used by HTTPS, and ports 20 and 21 are used by FTP. 

  • Enhanced Security

Using firewalls, access to specific ports can be blocked through configuration. This selective filtering can help in blocking unauthorized access and thus enhance the security of the network. For example, port 22 when blocked prevents unauthorized remote login attempts. 

  • Multiplexing Multiple Applications

It is because of ports that multiple applications can use the network simultaneously without any overlapping. Each application has its unique port number. The device uses this information to correctly route the incoming data to the intended application. Thus leaving no chance for confusion. 

What are some Popular Port Numbers?

There are a total of 65535 port numbers. So their range is from 0 to 65535. The list of port numbers is maintained by IANA and below are some commonly used port numbers along with their service and use. Have a look: 

  • 21: It is used by FTP i.e. File Transfer Protocol which transfers files over a network.
  • 22: This port number is used by SSH i.e. Secure Shell which provides a secure remote command-line login.
  • 23: It is used by Telnet for remote terminal access (unencrypted).
  • 25: This port is used by SMTP i.e. Simple Mail Transfer Protocol which is responsible for email routing.
  • 53: It is used by DNS i.e. Domain Name System which resolves domain names to IP addressed.
  • 80: This port number is used by HTTP i.e. Hypertext Transfer Protocol which is used for unencrypted web traffic.
  • 110: It is used by POP3 (Post Office Protocol version 3) which retrieves emails from a server.
  • 143: This port number is used by IMAP i.e. Internet Message Access Protocol which manages and retrieves emails from a mail server.
  • 443: It is used by HTTPS (Hypertext Transfer Protocol Secure) which is used for secure web traffic with encryption.
  • 465: This port number is used by SMTPS (SMTP Secure) which is for secure email sending.
  • 123: It is used by NTP i.e. Network Time Protocol which synchronizes clocks on networked devices.
  • 5060: This port number is used by SIP i.e. Session Initiation Protocol for VoIP communication.
  • 16384-32767: This range of port numbers is used by RTP i.e. Real-time Transport Protocol for audio and video transmission.
  • 2049: It is used by the Network File System for file sharing.
  • 3389: This port is used by RDP i.e. Remote Desktop Protocol to enable users to  to connect to their desktop computers from another device remotely

Practical Port Number Examples: Use Cases

There are endless applications and services in computer networking where ports are used. Some of the most common practical examples where ports are used:

  • VoIP-SIP Communication

In VoIP-SIP Communication, i.e. making and receiving calls over the Internet, SIP protocol is used. The SIP protocol makes use of port number 5060 for the same. 

  • Remote Access

RDP protocol for remote access

When a computer system is remotely accessed and controlled, the RDP i.e. Remote Desktop Protocol uses port 3389.

  • Database Access

When accessing and querying databases, MySQL uses port 3306 and PostgreSQL uses port 5432.

How to Find Your Port Number?

There might be some instances when you need to find your port number. While I have explained everything about ports and port numbers, let’s take a look at how you can find your port number on your device. 

How to Find Your Port Number on Windows

active ports

  • First, type “Cmd” in the search box
  • Now, open “Command Prompt”
  • After that, enter the netstat -a command to see your port numbers

How to Find Your Port Number on Mac

  • First, open “Terminal”
  • Then, type the netstat -a | grep -i “listen” command and press “Enter” to see the list of opened ports

How to Open a Port on Windows 10 and 11

  • First, go to the “Control Panel.”
  • Now, go to “System and Security” -> “Windows Defender Firewall.”
  • Then, select “Advanced settings.”
  • Now, click on “Inbound Rules” on the left.
  • After that, click on “New Rule” on the right.
  • Then, select the “Port” option.

ports on windows

  • Now, go to “Protocol and Ports.” Select the protocol (TCP or UDP) and add the port number to the “Specific Local Ports” section. If you want the list, then you can find the list here.
  • In the next step, press “Next” and choose “Allow the connection.”
  • Now, select what type of network this rule applies to and click “Next.”
  • Then, add a name and short description to the rule and click “Finish.”
  • At last, to close the port, simply remove the rule.

How to Open a Port on Mac?

  • Start by opening “System Preferences.”
  • Then, go to “Security and Privacy” > “Firewall” > “Firewall Options.”
  • After that, tap the plus sign.
  • Now, choose an application and click “Add.”
  • Then, make sure that “Allow Incoming Connections” is turned on.
  • Now, click “OK.”
  • At last, to close the port, simply remove it from the list.

Key Takeaway

From all that we have learned till now, it is clear that even the smallest details can have a significant impact on the grand architecture of the Internet. Ports and port numbers play a pivotal role in facilitating effective communication between devices and services. A proper understanding of port numbers is essential to configure firewalls, routers, and other network devices. Happy Networking!

The Author

Kanika Sharma

Kanika is a versatile researcher, blogger, and author, delving into the world of tech blogs covering Telecommunications and Cyber Security. With a solid engineering background, she turns intricate tech jargons into relatable, real-life stories. Her writing isn't just about words; it's a fusion of detail, intrigue, and relevance to the audience, reflecting her passion for writing and design. Beyond her work, Kanika finds joy in painting, and exploring new places while traveling.