CIDR Calculator
Enter how many hosts you need and this calculator returns the smallest IPv4 CIDR prefix that fits them, along with the total addresses, usable hosts, and how much space you would waste.
| Smallest CIDR fitting 50 hosts | /26 |
| Total addresses in /26 | 64 |
| Usable hosts | 62 |
| Address space wasted | 12 |
How to use this tool
- 1
Type the number of hosts you need to address into the 'Hosts needed' field.
- 2
Read the 'Smallest CIDR fitting' row to get the prefix length (for example /26).
- 3
Check the 'Total addresses' and 'Usable hosts' rows to confirm the block is big enough.
- 4
Look at the 'Address space wasted' row to see how many addresses you would leave unused at that prefix.
What does this CIDR host-count calculator actually do?
This is the inverse of a typical CIDR calculator. Instead of taking an IP and prefix and showing you the network address, broadcast, mask, and host range, it starts from a host count and works backwards to the smallest IPv4 prefix that fits. CIDR (Classless Inter-Domain Routing, RFC 4632) sizes subnets in powers of two, so a subnet is defined by its prefix length: a /26 holds 64 addresses, a /25 holds 128, and so on. The math here is exactly 32 minus the ceiling of log2(hosts + 2): the +2 reserves the network and broadcast addresses, and the ceiling rounds up to the next power of two. For 50 hosts you need at least 52 addresses, which rounds up to 64, giving a /26 with 62 usable hosts and 12 wasted. The 'wasted' figure (total minus 2 minus your hosts) is what makes this tool useful for capacity planning rather than just lookups. Note that the 32 is hardcoded, so this is IPv4 only with no IPv6 support, and the calculation always subtracts 2 for network and broadcast.
Common use cases
Sizing a new office VLAN by entering the expected device count and picking the prefix that leaves a little headroom.
Quickly checking whether a /24 is overkill for a subnet that only needs 30 hosts.
Comparing the wasted-address count across host estimates before you carve up a parent block.
Teaching subnetting students why 50 hosts needs 64 addresses and not 50.
Planning IP allocation for a fleet of IoT devices and confirming the block will not run out as you scale.
Sanity-checking a colleague's subnet proposal by reproducing the host-to-prefix math in seconds.
Frequently asked questions
Why does it subtract 2 from the total addresses?▼
Is the usable-host count right for /31 and /32 blocks?▼
Does this calculate the subnet mask, network address, or host range?▼
Does it support IPv6?▼
What happens if I enter a very large or empty host count?▼
Is there a Calculate button?▼
Is my data sent anywhere?▼
Related tools
DNS Lookup
Look up DNS records (A, AAAA, MX, TXT, NS) for any domain.
WHOIS Lookup
Get full WHOIS data for any domain.
SSL Certificate Checker
Check SSL certificate validity, issuer, and expiry.
HTTP Header Analyzer
Inspect HTTP response headers and security signals.
HTTP Status Code Checker
Check status code of any URL — single or bulk.
Redirect Chain Tracer
Follow every hop in a redirect chain.