IP Address Count Calculator
How many addresses a CIDR prefix or an address range contains, and how many prefixes it takes to cover a given host count.
Every CIDR prefix is a power of two: a /24 is 256 addresses, a /23 is 512, a /25 is 128.
How the ip address count calculator works
Every CIDR prefix is a power of two: a /24 is 256 addresses, a /23 is 512, a /25 is 128. Counting a range is subtraction plus one.
The direction people actually need is the reverse — "I have 900 hosts, what prefix do I need?" — which is the smallest power of two that covers them plus the two reserved addresses. Nine hundred hosts needs a /22, because a /23 gives only 510.
Formula: addresses = 2^(32 − prefix)
Worked examples
| Inputs | Addresses in the prefix | Note |
|---|---|---|
| A /22 for 900 hosts | 1,024 | 1,022 usable — a /23 would not fit |
| A /24 | 256 | 254 usable |
| A /8 | 16,777,216 | 16.7 million addresses |
FAQFrequently asked questions
How many addresses in a /24?
256, of which 254 are usable.
What prefix do I need for 900 hosts?
A /22. A /23 gives 510 usable, which is not enough, so the next size up is the answer.
Why is it always a power of two?
Because a prefix is a fixed number of leading bits; the rest are free, and n free bits give 2ⁿ combinations.
Can I use a range that is not a prefix?
For counting, yes. For routing, no — routes are advertised as prefixes, so an arbitrary range has to be decomposed into several.
How much of IPv4 is a /8?
One 256th — about 0.39%. There are only 256 of them, which is why they were exhausted.
Where these figures come from
- IEC 80000-13 — Information science and technology (quantities and units) — the decimal (kB, MB) versus binary (KiB, MiB) prefixes used throughout
- RFC 4632 — Classless Inter-domain Routing (CIDR) — the address-plan arithmetic behind the subnet calculator
- RFC 1918 — Address Allocation for Private Internets — the private ranges the subnet calculator recognises
- NIST SP 800-63B — Digital Identity Guidelines, Authentication — length over composition rules; the basis of the password guidance here
- NIST SP 800-57 Part 1 — Recommendation for Key Management — key-strength comparisons used by the key-space calculator
- National Cyber Security Centre — password guidance — UK national guidance on password policy
Last checked: September 2026. Units follow the SI decimal convention (IEC 80000-13 defines the binary alternatives); network and security figures cite the defining standard.