Understanding the NAT port capacity calculator — concept and principle
Network address translation with port translation (NAPT, often just called NAT or PAT) lets many private devices share a few public IP addresses. Each outgoing connection is given a public IP and source port pair, and the pool of ports is finite. This calculator estimates how many users a set of public addresses can support for a chosen number of ports per user.
How it is calculated
Users supported = public IPs × usable ports per IP ÷ ports per user.
- Usable ports per IP: the default 64,512 is the range 1024–65535 (65,536 − 1,024), skipping the well-known ports 0–1023.
- Ports per user: how many simultaneous translations you allow or expect each user to need.
The result can have decimals; only whole users count, so round down.
The principle
A TCP or UDP port number is a 16-bit field, so there are 65,536 values per address and per protocol. The NAT device rewrites each private source address and port into a public address and a free port, and remembers the mapping so replies can be sent back. While a mapping is active, that public port is busy. Dividing the pool by the ports each user holds gives the number of users who can be active at once. TCP and UDP have separate port spaces, and some NAT implementations can reuse the same public port for connections to different destinations, so real capacity can be higher than this simple count; others allocate fixed port blocks per subscriber, which matches the formula closely.
Worked example
- Inputs: 1 public IP, 64,512 usable ports, 100 ports per user.
- Total ports: 1 × 64,512 = 64,512.
- Users: 64,512 ÷ 100 = 645.12, rounded down to 645 whole users.
| Ports per user | Users supported |
|---|---|
| 25 | 2,580 |
| 50 | 1,290 |
| 75 | 860 |
| 100 | 645 |
| 125 | 516 |
| 150 | 430 |
| 200 | 322 |
How to read the result
If your users regularly hit the port limit, new connections fail or stall, which looks like random web pages not loading. Modern web pages, apps that keep many background connections and peer-to-peer software can each need hundreds of ports at busy moments. To raise capacity, add public IPs, shorten idle timeouts for finished connections, or move traffic to IPv6, where no port sharing is needed.
Common mistakes
- Assuming one public IP is enough for any number of users.
- Ignoring that idle mappings stay allocated until their timeout expires.
- Planning with an average port count when peaks matter.
Frequently asked questions
Why exclude ports below 1024?
They are the system or well-known ports assigned to standard services, so many NAT devices avoid using them as translated source ports.
How many ports does a typical user need?
It varies widely with usage. Light browsing may need dozens; heavy applications can need hundreds or more at peak.
Does IPv6 need NAT port planning?
Generally not. IPv6 gives each device its own global address, so port exhaustion from sharing does not arise.
Sources: IETF RFC 6335, IANA Procedures for the Management of the Service Name and Transport Protocol Port Number Registry · IETF RFC 4787, NAT Behavioral Requirements for Unicast UDP · IETF RFC 6888, Common Requirements for Carrier-Grade NATs (CGNs)