CIDR Prefix to Hosts Calculator
Pick a prefix length and see the address count, usable hosts and mask.
Your numbers
Your results
Total addresses
Total addresses
—
Usable hosts
—
Subnet mask
—
Equivalent /24 networks
—
CIDR Prefix to Hosts Calculator by TheCalcTools
How the CIDR Prefix to Hosts Calculator works
Enter the prefix length shown after the slash in CIDR notation.
The number of host bits is 32 minus the prefix.
Each extra host bit doubles the block size.
The formula
Total addresses = 2^(32 − n)Usable hosts = 2^(32 − n) − 2
Worked example
Using the default values shown in the calculator:
| Prefix length (/n) | 22 |
|---|
- A /22 leaves 32 − 22 = 10 host bits.
- 2^10 = 1,024 addresses, so 1,022 usable hosts.
- The mask is 255.255.252.0, equal to 4 /24 networks.
Result:
| Total addresses | 1,024 |
|---|---|
| Usable hosts | 1,022 |
| Subnet mask | 255.255.252.0 |
| Equivalent /24 networks | 4.0000 |
Frequently asked questions
How many addresses are in a /24?
256 addresses, 254 of them usable for hosts.
What prefix do I need for 500 hosts?
You need at least 502 addresses, so 2^9 = 512 fits: a /23.
Sources and further reading
Related calculators
More in IP & Domain Tools · All calculators
This calculator gives estimates for information only. Check important results independently before you rely on them. See our disclaimer.
