Subnet Mask Prefix Length Calculator

Convert prefixes to masks and ranges without guesswork. Check hosts, wildcard values, and binary bits. Analyze IPv4 networks quickly with exports, examples, and charts.

Calculator Form

Optional. Add it to calculate network and broadcast details.
Enter a CIDR prefix such as 24 or 27.
Optional if prefix length is already provided.
Find the smallest fitting prefix for host demand.
Subtract internal reservations from usable capacity.
Adds class, default prefix, and subnet bit comparison.
Reset

Example Data Table

IPv4 Address Input Subnet Mask Network Broadcast Usable Hosts
192.168.10.14 /24 255.255.255.0 192.168.10.0 192.168.10.255 254
10.0.5.130 /26 255.255.255.192 10.0.5.128 10.0.5.191 62
172.16.8.200 255.255.248.0 255.255.248.0 172.16.8.0 172.16.15.255 2046

Formula Used

Prefix length equals the count of binary ones in the subnet mask. A /24 mask contains twenty-four leading ones and eight trailing zeros.

Subnet mask conversion uses contiguous binary bits. The dotted decimal mask comes from grouping the thirty-two bits into four octets.

Total addresses = 2^(32 - prefix). Conventional usable hosts = total addresses - 2. The common exceptions are /31 point-to-point links and /32 host routes.

Wildcard mask = 255.255.255.255 - subnet mask. Network address = IPv4 address AND subnet mask. Broadcast address = network address OR wildcard mask.

How to Use This Calculator

  1. Enter a prefix length, a subnet mask, or both.
  2. Add an IPv4 address when you want network-specific results.
  3. Enter required usable hosts to get a recommended prefix.
  4. Add reserved IPs to see effective capacity after exclusions.
  5. Click Calculate to show results above the form.
  6. Use the CSV or PDF buttons to export the result table.

Why This Calculator Helps

This subnet mask prefix length calculator helps network planning, VLAN sizing, IPv4 troubleshooting, address allocation, and CIDR verification. You can convert masks and prefixes in either direction, inspect binary values, review host capacity, and export the result table for documentation. The optional IPv4 field extends the calculation into network address, broadcast address, and usable host range analysis.

The classful comparison is useful for learning and auditing older documentation. The required host option can support quick design choices before a network change. Reserved IP tracking helps estimate effective usable capacity after infrastructure assignments. The chart gives a fast visual summary of address scale, usable count, and remaining effective capacity after reservations.

FAQs

1. What does prefix length mean?

Prefix length is the number of leading one bits in a subnet mask. It defines how much of an IPv4 address belongs to the network portion.

2. How do I convert /27 to a subnet mask?

A /27 uses twenty-seven network bits. Its dotted decimal subnet mask is 255.255.255.224.

3. Why does a /24 usually show 254 usable hosts?

A /24 contains 256 total addresses. In common subnetting practice, one network address and one broadcast address are not assigned to hosts.

4. What is a wildcard mask?

A wildcard mask is the inverse of the subnet mask. It is often used in routing, access control lists, and matching address ranges.

5. Can I calculate a network without entering an IPv4 address?

Yes. You can still convert prefix length and subnet mask, see binary values, and review host capacity. Network and broadcast results need an IPv4 address.

6. Why are /31 and /32 special?

A /31 can be used on point-to-point links. A /32 identifies one host route. These cases do not follow the usual host subtraction rule.

7. What does effective usable hosts mean?

Effective usable hosts equals conventional usable hosts minus any custom reserved IPs you entered. It estimates practical capacity after internal assignments.

8. When should I use the recommended prefix feature?

Use it during planning. Enter your required usable host count to find the smallest subnet that can support that demand.

Related Calculators

Important Note: All the Calculators listed in this site are for educational purpose only and we do not guarentee the accuracy of results. Please do consult with other sources as well.