🧮Subnet Mask Calculator

Size a block from the host count

This tool takes no IP address. It works only with prefixes, masks and host counts, so it does not print network addresses or usable IP ranges.

1. Host count → smallest prefix

2. Mask ↔ prefix ↔ wildcard

3. Split a block into N subnets

You Might Also Need

What this calculator does

This tool sizes a block backwards from the host count. Enter the number of devices you need to fit and it returns the smallest block that holds them: the prefix, the subnet mask, the wildcard mask and the spare capacity left over. Masks, prefixes and wildcard masks convert into one another, with the mask shown in binary as well. It also works out how many bits each subnet takes when you split one block into several.

How the numbers are derived, and the /31 and /32 exceptions

The subnet mask for a /n is a 32-bit value with the first n bits set to 1, and the wildcard mask is that value inverted. The total address count is 2 to the power of (32 - n), and the usable host count normally subtracts the network and broadcast addresses. A /31, however, uses both of its addresses as hosts on point-to-point links under IETF RFC 3021, and a /32 is a single host route with one address. Subtracting 2 in those two cases would give zero or a negative number, so they are branched separately. Checked October 2026.

Limits and what it will not do

Only equal-size splits are supported; mixed-size VLSM designs are not. Splits land on powers of two, so you may get more subnets than you asked for. Because no IP address is entered, network and broadcast addresses and usable IP ranges are not calculated, and IPv6 is out of scope. Confirm your routing and reserved-address policy before applying any of this to live equipment.

Frequently Asked Questions

Why does a /31 show 2 usable hosts?

The usual formula subtracts 2 from the 2 total addresses and gives zero, but IETF RFC 3021 allows both addresses to be used as hosts on point-to-point links. A /32 shows 1 for the same reason.

Why does 500 hosts return a /23?

A /24 offers only 254 usable hosts, which is short, while a /23 offers 510. So /23 is the smallest block that holds 500 hosts, and the 10 spare hosts are shown alongside.

What does this tool not do?

It does not take an IP address and print the network address, the broadcast address or the usable IP range. The CIDR IP range calculator covers that.