Use this advanced calculator to convert between CIDR notation, subnet masks, and host requirements. It also derives network details, wildcard masks, usable host ranges, CSV exports, PDF exports, and a visual scaling chart for nearby prefixes.
Calculator
Choose a mode, enter your values, and submit. Results appear above this form after calculation.
Example Data Table
| Prefix | Subnet Mask | Wildcard Mask | Total Addresses | Typical Usable Hosts | Common Use |
|---|---|---|---|---|---|
| /30 | 255.255.255.252 | 0.0.0.3 | 4 | 2 | Small point links |
| /29 | 255.255.255.248 | 0.0.0.7 | 8 | 6 | Tiny device groups |
| /28 | 255.255.255.240 | 0.0.0.15 | 16 | 14 | Small office segments |
| /27 | 255.255.255.224 | 0.0.0.31 | 32 | 30 | Department VLANs |
| /24 | 255.255.255.0 | 0.0.0.255 | 256 | 254 | Standard LANs |
| /16 | 255.255.0.0 | 0.0.255.255 | 65,536 | 65,534 | Large internal ranges |
Formula Used
Prefix length equals the count of 1 bits inside the subnet mask.
Subnet mask is built from prefix 1s followed by host 0s.
Total addresses = 232 - prefix.
Typical usable hosts = total addresses - 2.
Wildcard mask = 255.255.255.255 - subnet mask.
Network address = IP address AND subnet mask.
Broadcast address = network address + total addresses - 1.
Note: /31 and /32 are special cases. Many engineers treat /31 as a two-address point-to-point subnet and /32 as a single host route.
How to Use This Calculator
- Choose whether you want to start from CIDR, subnet mask, or usable host demand.
- Enter the matching value in the active input field.
- Add an IPv4 address when you want network and broadcast details.
- Press the calculate button to generate the subnet summary.
- Review the cards above the form for all derived values.
- Inspect the chart to compare nearby subnet capacities quickly.
- Use the export buttons to save the result as CSV or PDF.
Frequently Asked Questions
1. What is a subnet prefix length?
A subnet prefix length shows how many bits belong to the network portion of an IPv4 address. For example, /24 means 24 network bits and 8 host bits.
2. How do I convert a subnet mask to CIDR notation?
Count the contiguous 1 bits in the binary subnet mask. A mask of 255.255.255.0 contains 24 leading 1 bits, so it becomes /24.
3. Why are usable hosts fewer than total addresses?
Traditional IPv4 subnetting reserves one address for the network ID and one for the broadcast address. That is why a subnet usually offers two fewer usable host addresses.
4. What makes /31 and /32 different?
A /31 is commonly used on point-to-point links and can represent two endpoints. A /32 is a single host route, often used for loopbacks, host entries, or exact matches.
5. Can I calculate a prefix from required hosts?
Yes. Enter the number of usable hosts needed, and the calculator returns the smallest standard IPv4 prefix that can satisfy that capacity requirement.
6. What is a wildcard mask used for?
A wildcard mask is the inverse of the subnet mask. It is widely used in router access rules, matching logic, and other networking configurations.
7. Do I need to enter an IP address every time?
No. Prefix, subnet mask, wildcard mask, and host capacity can be calculated without an IP address. Add one only when you need network and broadcast results.
8. When should I choose a shorter or longer prefix?
Choose a shorter prefix when you need more addresses. Choose a longer prefix when you want smaller subnets, tighter segmentation, or improved address efficiency.