IPv4 Subnet Host Count
Calcula número de hosts utilizáveis em uma subnet IPv4: 2^(32-prefix) − 2.
Hosts
—
IPv4 host count per subnet
To count the usable hosts in an IPv4 subnet, use 2^(32 − n) − 2, with n standing for the CIDR prefix length. You lose two addresses every time: the network address, where all host bits are 0, and the broadcast address, where they're all 1. Run the numbers and a /24 gives 256 − 2 = 254 hosts. A /23 gives 510, a /22 gives 1,022, and a /16 jumps to 65,534. At the small end, a /30 leaves you 2 addresses for point-to-point links, while a /31 also gives 2 thanks to RFC 3021, which skips the reservation entirely. The rules for subnetting come from RFC 950, and VLSM (Variable-Length Subnet Mask) is what lets you mix different prefix sizes inside one allocation.
Applications and context
This math shows up in enterprise network design, when ISPs hand out blocks to customers, when you size CIDR ranges for datacenters or Kubernetes pods, while planning a VPC on AWS/Azure/GCP, and across IP address management (IPAM) in general. The private ranges from RFC 1918 — 10.0.0.0/8, 172.16.0.0/12 and 192.168.0.0/16 — leave more than enough room for just about any internal topology you'd build.
FAQ
Why subtract 2? The first address names the network itself, and the last one is the directed broadcast. Neither is available to hand to a host.
What is special about /31? On point-to-point links, RFC 3021 lets you run a /31 without setting aside the network and broadcast addresses, so you end up with exactly 2 usable addresses.
And /32? That's a single host route. You'll see it on loopbacks, on anycast endpoints, and in firewall rules that target one specific host.
Related Tools
Rent Adjustment Calculator
Compute annual rent adjustment by IGP-M or IPCA accumulated in the last 12 months (manually configurable).
Pregnancy Calculator
Compute estimated due date (EDD), gestational age and trimester from the last menstrual period (LMP).
Fertile Period Calculator
Compute fertile window and ovulation day from the first day of the last cycle and the average cycle length.