Subnet Mask Calculator

A CIDR prefix like /24 packs a lot of networking information into two characters — this expands it into the actual subnet mask, the number of usable host addresses, and the wildcard mask, all of which are needed for real network configuration.

Inputs

Result

255.255.255.0 /24

Usable hosts 254 · Wildcard 0.0.0.255

How the subnet mask calculator works

The subnet mask is built by setting the first n bits (the CIDR prefix) to 1 and the remaining bits to 0, then displaying that 32-bit value in standard dotted-decimal form.

Usable hosts = 2^(32−n) − 2 for typical prefixes, subtracting the network address and broadcast address, which aren't assignable to individual devices.

The wildcard mask is the bitwise complement (inverse) of the subnet mask, used in some networking contexts like access control lists.

Worked example: /24 prefix

  1. Subnet mask: 255.255.255.0.
  2. Usable hosts = 2^(32−24) − 2 = 2⁸ − 2 = 256 − 2 = 254.
  3. Wildcard mask (inverse of the subnet mask): 0.0.0.255.

Common mistakes to avoid

Forgetting to subtract the network and broadcast addresses from usable host count

A /24 network has 256 total addresses, but only 254 are usable for actual devices — the first address is reserved for identifying the network itself, and the last is reserved for broadcasting to every device on it.

Confusing CIDR prefix length with a percentage or a byte count

The number after the slash (like /24) refers to how many bits, out of 32 total, are fixed as the 'network' portion — it's not a percentage of the address space and doesn't directly correspond to a whole number of bytes except at specific boundaries like /8, /16, /24.

Frequently asked questions

Why do /31 and /32 networks have 0 usable hosts by this calculation?

At /31 there's no room left for separate network and broadcast addresses under the traditional scheme (though /31 has a special point-to-point-link exception in some contexts), and /32 identifies a single specific host address with no room for a broader network at all.

What's the practical difference between a /24 and a /16 network?

A /24 provides 254 usable addresses (a common small office/home network size); a /16 provides 65,534 usable addresses (a much larger allocation), since fewer bits are fixed for the network portion, leaving more for individual host addresses.

What is a wildcard mask actually used for?

It's the inverse of the subnet mask, commonly used in access control list (ACL) configurations on networking equipment, where matching rules are often expressed in terms of which bits should be ignored (wildcarded) rather than which bits must match exactly.

How is CIDR notation different from the older 'Class A/B/C' network system?

CIDR (Classless Inter-Domain Routing) allows any prefix length from 0 to 32, offering far more flexible network sizing than the older fixed-size class system it replaced, which only supported a few rigid network size options.

Related calculators