Port Numbers on Computer Networks

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. 

Port numbers are associated with TCP/IP network connections. They 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.


Do not confuse this kind of port with the 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 a computer has a main address and a set of port numbers to handle incoming and outgoing connections.

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 21 for FTP and 80 for HTTP). To find the specific values used by certain applications, see this TCP / UDP Port Number Glossary. Those using Apple software can also refer to TCP and UDP ports used by Apple software products.

When You May Need to Take Action with Port Numbers

Port numbers are processed by network hardware and the 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.
  • sometimes, a Web site URL will 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: Open ports have an associated application listening for new connection requests while closed ports do not.

A process called network port scanning directs 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.