What is a port number? Definition, types, and examples

Every computer has 65,536 port numbers, grouped into three types. They work with your IP address to form sockets and direct data to the right destination. Knowing the right port number is helpful for technical tasks like looking up DNS information or setting up custom server connections. In this article, we’ll explain what a port number is and what it is used for, with real-life examples. 

Servers and port numbers

What is a port number?

A port number is a virtual identifier that directs data from a network to the right application on your device. Each network port number is a 16-bit unsigned integer ranging from 0 to 65,535. These numbers identify different communication endpoints to route data to the correct destination, either on a single device or on different devices across the same network. 

Port numbers for common applications and services are standardized by the Internet Assigned Numbers Authority (IANA) opens in a new tab. For example, encrypted web traffic on an HTTPS connection flows through port 443.  

Port numbers are one component of the larger transport layer (TCP/UDP), which works alongside the network layer to move data across the internet. The network layer (IP) delivers data to the correct device using its IP address, while the transport layer uses port numbers to deliver that data to the correct application on the device.

What are port numbers used for?

Port numbers are used to direct network traffic to the right application on a device. Port numbers work in combination with an IP address to form a socket. This is the infrastructure that ensures each data packet gets to the correct destination. 

Think of each socket as an apartment building. The apartment’s street address is the IP address, which gets the “mail” to the right building. The individual apartment numbers are port numbers, meaning they get the mail to the correct tenant inside. Without apartment numbers, mail would arrive at a building with no way to tell which apartment it was for. Without port numbers, data from a network connection reaches the right device but has no way to reach the correct application. 

What are the different types of port numbers?

Three different types of port numbers are split into specific ranges: 

  • Well-known ports range from 0 to 1023 and are assigned for specific services. They include the HTTP (port 80), HTTPS (port 443), FTP (ports 20 and 21), and DNS port (53). 
  • Registered ports range from 1024 to 49151 and are assigned to applications for specific users or vendors. 
  • Dynamic or private ports range from 49152 to 65535 and are used for temporary connections between clients and server applications. These ports can be set up to create private connections with specific devices on a local network. 

What’s the difference between a TCP and a UDP port?

TCP and UDP are the two most common transport protocols that use port numbers to transfer data. While both route data to the correct port number, they use different types of connections to do so. Here’s the difference between these two port types: 

  • Transmission Control Protocol uses a connection to send data over a network. It facilitates a “handshake” between the sender and the recipient before the data is sent and preserves the order of the data segments. TCP provides reliable, ordered delivery by acknowledging received segments and retransmitting any that are lost.
  • User Datagram Protocol is connectionless, with no handshake between parties, no guarantee of delivery, and no preservation of the packet order. It works faster and requires lower overhead than a TCP port. 

TCP port

UDP port

Connection type

Uses a connection

Does not use a connection

Reliability

Handshake and delivery guarantee

No delivery guarantee

Segment order

Preserved

Not preserved

Speed

Slower but more reliable

Faster but less reliable

Example ports

80 (HTTP), 443 (HTTPS), 22 (SSH)

53 (DNS), 51820 (WireGuard)

Example use cases

Web browsing, email, file transfer, SSH encryption, DNS over HTTPS

Video calls, online gaming, live streaming, VoIP

Common port numbers

Out of the 65,536 port numbers currently available, only a handful are widely used for essential services, such as HTTP, HTTPS, and DNS. Here are some of the most common port numbers: 

Port number

Description

20

FTP (File Transfer Protocol) data transfer

21

FTP (File Transfer Protocol) command control

22

SSH (Secure Shell)

23

Telnet

25

SMTP (Simple Mail Transfer Protocol)

53

DNS (Domain Name System)

67, 68

DHCP (Dynamic Host Configuration Protocol)

80

HTTP (Hypertext Transfer Protocol)

110

POP3 (Post Office Protocol)

119

NNTP (Network News Transfer Protocol)

123

NTP (Network Time Protocol)

143

IMAP (Internet Message Access Protocol)

161

SNMP (Simple Network Management Protocol)

194

IRC (Internet Relay Chat)

443

HTTPS (Hypertext Transfer Protocol Secure)

546, 547

DHCPv6 (Dynamic Host Configuration Protocol version 6)

These are port numbers you’ll see most often, but they’re only a small fraction of the total number of ports available. 

Port numbers and security

The security of a port depends on the specific service running on it and how it’s configured. Port numbers themselves aren’t inherently secure or insecure. For example, a service on port 80 can be secure if it’s properly configured, while a service on an obscure port can be vulnerable to cyberattacks if it isn’t maintained properly. 

Open ports are more vulnerable to cyberattacks than closed ports because they accept incoming traffic. Cybercriminals often use port scanning tools to find open ports in systems. They can exploit vulnerabilities in exposed services to gain unauthorized access to the network. Outdated services listening on open ports are particularly vulnerable to cyberattacks. So, if you use port forwarding to control traffic on your local network, it could also make you more vulnerable to cyberattacks. 

However, some software simply won’t work if you don’t have the needed ports open. That’s also the case for VPNs. Your protocol of choice dictates which VPN port needs to be open. For example, NordVPN’s NordLynx protocol — NordVPN’s proprietary implementation of WireGuard® — requires UDP port 51820.

To stay safe, keep all your apps and services updated to their latest versions. Only open ports on your router when necessary, and use firewalls to restrict their access. 

Don’t let your router be your weak spot.

Secure it with VPN encryption from NordVPN

FAQ

NordVPN experts

NordVPN experts

Our NordVPN experts know the ins and outs of cybersecurity solutions and strive to make the internet safer for everyone. With a finger on the pulse of online threats, they share their expertise and practical tips on how to avoid them. Whether you're a tech newbie or a seasoned user, you'll find valuable insights in their blog posts. Cybersecurity should be accessible to everyone — and we're making that happen, one blog post at a time.