What is the Highest TCP Port Number Allowed?

The highest TCP port number is 65,535.

The TCP protocol provides 16 bits for the port number, and this is interpreted as an unsigned integer; all values are valid, apart from 0, and so the largest port number is (2^16 - 1) or 65,535. This is true for TCP IPv4 and IPv6, as the same TCP header format is used irrespective of TCP version.

On Linux, it is easy to check this:

$ telnet localhost 65535
Trying 127.0.0.1...

Above: telnet tries to connect when port 65,535 is used. Whether it succeeds or not depends on whether there is a telnet server listening on that port, but telnet can still attempt the connection.

$ telnet localhost 65536
65536: bad port number

Above: conversely, telnet fails immediately with bad port number when port 65,536 is used.

Related

Blog: Cloudy with a Chance of TCP Drops
Network Data: Key Concepts
Network Performance Monitoring
Corvil for IT Operations Analytics