What Are Port Numbers?

Young woman working at her desk
moodboard/Brand X Pictures/Getty Images

In computer networking, port numbers are part of the addressing information used to identify the senders and receivers of messages. They are associated with TCP/IP network connections, and might be described as a sort of add-on to the IP address.

Port numbers allow different applications on the same computer to share network resources simultaneously. Home network routers and computer software work with these ports and sometimes support configuring port number settings.

Note: Neworking ports are software-based and unrelated to physical ports that network devices have for plugging in cables.

How Port Numbers Work

Port numbers relate to network addressing. In TCP/IP networking, both TCP and UDP utilize their own set of ports that work together with IP addresses.

These port numbers work like telephone extensions. Just as a business telephone switchboard can use a main phone number and assign each employee an extension number (like x100, x101, etc.), so too can a computer have a main address and a set of port numbers to handle incoming and outgoing connections.

In the same way that one phone number can be used for all the employees within that building, one IP address can be used to communicate with various kinds of applications behind one router; the IP address identifies the destination computer and the port number identifies the specific destination application.

This is true whether it be a mail application, file transfer program, web browser, etc. When a user requests a website from their web browser, they're communicating over port 80 for HTTP, so the data is then sent back over that same port and displayed within the program that supports that port (the web browser).

In both TCP and UDP, port numbers start at 0 and go up to 65535. Numbers in the lower ranges are dedicated to common internet protocols like port 25 for SMTP and port 21 for FTP.

To find the specific values used by certain applications, see our list of The Most Popular TCP and UDP Port Numbers. If you're dealing with Apple software, see TCP and UDP Ports Used by Apple Software Products.

When You May Need to Take Action With Port Numbers

Port numbers are processed by the network hardware and software automatically. Casual users of a network do not see them nor need to take any action involving their operation.

Individuals can, however, encounter network port numbers in certain situations:

  • Network administrators may need to set up port forwarding to allow the port numbers of specific applications to pass through a firewall. On home networks, broadband routers support port forwarding on their configuration screens.
  • Network programmers sometimes need to specify port numbers in their code, such as in socket programming.
  • A website URL will somtimes require a specific TCP port number to be included. For example, http://localhost:8080/ uses TCP port 8080 rather than the default port 80. Again, this is usually seen in software development environments than in mainstream usage.

    Open and Closed Ports

    Network security enthusiasts also frequently discuss port number usage as a key aspect of attack vulnerabilities and protections. Ports can be classified as either open or closed, where open ports have an associated application listening for new connection requests and closed ports do not.

    A process called network port scanning detects test messages at each port number individually to identify which ports are open. Network professionals use port scanning as a tool to measure their exposure to attackers and often lock down their networks by closing non-essential ports. Hackers, in turn, use port scanners to probe networks for open ports that may be exploitable.

    The netstat command in Windows can be used to see information regarding active TCP and UDP connections.

    Was this page helpful?