Skip to content
Calcrivo

Socket Calculator

Calculate maximum concurrent socket connections a server can support.

Inputs

IANA-recommended ephemeral range starts at 49152; Linux commonly uses 32768

Theoretical Max Sockets (all ports, all IPs)

65,535

Ephemeral Ports Available per IP

16,384

Total Ephemeral Ports Across All IPs

16,384

Step by step

  1. Values used

    Number of IP Addresses = 1; Ephemeral Port Range Start = 49,152; Ephemeral Port Range End = 65,535

  2. Max sockets

    max_sockets = IPs × 65535

  3. Ephemeral ports per IP

    ephemeral_ports = ephemeral_end − ephemeral_start + 1 (16,384 for IANA range 49152-65535)

  4. Theoretical Max Sockets (all ports, all IPs)

    = 65,535

  5. Ephemeral Ports Available per IP

    = 16,384

  6. Total Ephemeral Ports Across All IPs

    = 16,384

How it works

Each IP address exposes 65,535 usable TCP port numbers (1-65535; port 0 is reserved), so the theoretical maximum socket count scales linearly with the number of local IP addresses available. In practice, outbound (client-initiated) connections draw from a narrower ephemeral port range — the IANA-recommended range is 49152-65535 (16,384 ports), though many Linux distributions default to a wider 32768-60999 range — since well-known (0-1023) and registered (1024-49151) ports are reserved for services and specific applications rather than transient outbound connections.

Formulas

Max sockets

max_sockets = IPs × 65535

Ephemeral ports per IP

ephemeral_ports = ephemeral_end − ephemeral_start + 1 (16,384 for IANA range 49152-65535)

Frequently Asked Questions

Why does the IANA ephemeral range start at 49152 instead of 1024?

Ports 1024-49151 are the 'registered' range, reservable by IANA for specific applications and protocols (avoiding collisions for well-known but non-privileged services) — the ephemeral range starting at 49152 is set aside specifically for transient, client-side outbound connections that don't need a fixed, registered port number.

Why do Linux systems often use a different ephemeral range (32768-60999)?

This is a long-standing Linux kernel default (configurable via net.ipv4.ip_local_port_range) that predates or diverges from the IANA recommendation, providing a similarly-sized pool of around 28,000 ports — the exact range doesn't matter much for capacity as long as it doesn't overlap with ports used by listening services on the same host.

How can I increase the effective number of outbound connections beyond the ephemeral range limit?

Since a socket is uniquely identified by the 4-tuple of (local IP, local port, remote IP, remote port), the same local port can be reused simultaneously for connections to different remote endpoints — so adding more local IP addresses, or connecting to more distinct remote endpoints, both increase effective outbound capacity beyond what the ephemeral port count alone would suggest for a single remote destination.

You might also need