We Value Your Privacy

We use cookies to enhance your browsing experience and analyze site traffic. All calculations happen locally in your browser - we never see or store your data. Learn more in our Privacy Policy

/
/
CalculateYogi
  1. Home
  2. Technology
  3. NAT Port Exhaustion Calculator
Technology

NAT Port Exhaustion Calculator

Work out SNAT port utilisation per instance or across a NAT pool, using Azure's published allocation table and the real port hold-down timers.

Common situations
What are you sizing?
s
s

Azure's default SNAT port allocation

Quoted from Azure Load Balancer's default port allocation table. Each backend instance receives this many ports per frontend IP, up to a maximum of 1,024 — so past that point, extra frontend IPs add nothing. Microsoft's own guidance is not to use default allocation for production.

Backend pool sizePorts per instance, per frontend IP
1–501,024
51–100512
101–200256
201–400128
401–80064
801–1,00032

Why a port is not free when the connection ends

Azure holds a SNAT port for 65 seconds after a TCP FIN closes the connection, and 16 seconds after a TCP RST. An idle connection holds its port until the idle timeout, which is configurable from 4 minutes to 120 — and Microsoft advises against raising it precisely because long timers make exhaustion more likely. A NAT gateway sidesteps the preallocation problem entirely by pooling 64,512 ports per public IP and issuing them on demand.

Did this calculator solve your problem today?

Contributor

Reviewed by

Last updated: September 14, 2026
SupportI build these free tools with love, late nights, and way too much coffee. If this calculator helped you, a small donation would mean the world to me and help keep this site running. Thank you for your kindness!

Related Calculators

You might also find these calculators useful

Subnet Calculator

Network, broadcast, mask and usable hosts for any IPv4 subnet

CIDR Calculator

Convert CIDR to a range, split a block, or aggregate blocks

TCP Throughput & BDP Calculator

Find the bandwidth-delay product and the TCP window a link needs

Server Capacity Calculator

How many users one server holds, and what limits it

Find Out Whether You Are About to Run Out of Ports

Outbound connections fail when a NAT device runs out of source ports to give them. On Azure that happens per backend instance rather than across the load balancer, which is why a pool with thousands of free ports can still refuse new connections from one VM. Enter your connection profile and this calculator works out how many ports each host or instance actually occupies — including the ones still in hold-down after a connection closes, which is where most of them go.

What Port Exhaustion Actually Is

Every outbound connection needs a unique source port on the public IP it leaves from. A public IP has 65,535 ports; Azure makes 64,000 of them eligible for SNAT on a load balancer frontend, and 64,512 on a NAT gateway. A port is not free the instant the connection closes: Azure holds it for 65 seconds after a TCP FIN and 16 after a TCP RST. So the ports a workload occupies are the connections it has open PLUS the ones it opened recently and closed — which for short-lived connections is the larger half.

Ports occupied

How to Use the Calculator

1

2

3

4

5

When to Use It

Intermittent outbound connection failures

The symptom is timeouts to one destination while everything else works. Check whether one instance's allocation is the constraint.

Sizing before a migration

Work out how many public IPs a workload needs before it moves, rather than after it starts failing.

Deciding between a load balancer and a NAT gateway

Compare a fixed preallocated slice against a pooled, on-demand inventory at your own connection profile.

Justifying connection pooling

See how much of your port budget short-lived connections spend in hold-down, which is the case for reusing them.

Why This Is Hard to Diagnose

Exhaustion is per instance, not per pool

Microsoft is explicit: a backend instance can run out of its allocated ports while the load balancer still has plenty unused. A pool-wide average will not show you the failure.

The default allocation is smaller than people expect

A 300-instance backend pool gets 128 ports per instance per frontend IP. Not 64,000 — 128. The table on this page is Azure's own.

Extra IPs stop helping at 1,024 ports

The default allocation is capped per instance. Attaching a third frontend IP to a small pool buys exactly nothing, which is not obvious from the portal.

Short connections cost more, not less

A connection that lives five seconds and then holds its port for sixty-five spends most of its port's life closed. Connection reuse is the fix, and it is why the hold-down field here changes the answer.

Frequently Asked Questions

Too many simultaneous outbound connections from one backend instance to the same destination, against the ports that instance was allocated. Every connection to a distinct destination IP and port needs its own SNAT port, and the port stays unusable for 65 seconds after a TCP FIN closes it. Applications that open a new connection per request rather than reusing one hit this first — the connections may be brief, but each one's port is tied up for a minute afterwards.

It depends on which outbound method you use. With a load balancer's default port allocation it comes from Azure's table by backend pool size: 1,024 ports per instance for a pool of 1–50, 512 for 51–100, 256 for 101–200, 128 for 201–400, 64 for 401–800 and 32 for 801–1,000 — per frontend IP, capped at 1,024 per instance in total. A NAT gateway instead pools 64,512 ports per public IP and issues them on demand with no preallocation.

On a NAT gateway, yes — each public IP adds 64,512 ports to the shared pool. On a load balancer using default allocation, only up to a point: the per-instance allocation is capped at 1,024 ports however many frontend IPs you attach, so a small backend pool already at the cap gains nothing. Past that you either allocate ports manually with an outbound rule or move to a NAT gateway, which is what Microsoft recommends.

Because the ports are preallocated per instance. Microsoft states it directly: exhaustion occurs when a backend instance runs out of its given ports, and the load balancer can still have unused ones. The pool-wide figure is not the number that decides whether your next connection succeeds — which is why this calculator's Azure mode reports per instance.

Yes, and raising it makes things worse. An idle connection keeps its SNAT port until the timeout expires, configurable from 4 minutes up to 120. Microsoft advises against increasing it for exactly this reason and suggests TCP keepalives instead, which refresh a long-lived connection without holding extra ports.

CalculateYogi

The most comprehensive calculator web app. Free, fast, and accurate calculators for everyone.

Calculator Categories

  • Math
  • Finance
  • Health
  • Conversion
  • Date & Time
  • Statistics
  • Science
  • Engineering
  • Business
  • Everyday
  • Construction
  • Education
  • Technology
  • Food & Cooking
  • Sports
  • Climate & Environment
  • Agriculture & Ecology
  • Social Media
  • Other

Company

  • About
  • Contact
  • Contributors

Legal

  • Privacy Policy
  • Terms of Service
  • Editorial Policy

© 2026 CalculateYogi. All rights reserved.

Sitemap

Made with by the AppsYogi team