Skip to content
FiftyCalc Free calculators for all 50 states

CIDR Calculator

Test cases replayed : 4 of 4 match · Methodology · No outside source listed

Choose a prefix length to see the subnet mask, the wildcard mask and how many addresses the block holds.

Result

Sample figures

Subnet mask—

Wildcard mask —

  • Total addresses in the block—
  • Usable host addresses—

Estimate for planning only, not tax, legal, financial or medical advice. This calculator uses the method explained on this page.

CIDR Calculator

Prefix length (the number after the slash, 0 to 32): enter a number from 0 to 32. Prefilled example: 24.

How to use this calculator

Fill in the fields in this order; each step takes you to its field.

  1. Prefix length (the number after the slash, 0 to 32): enter a number from 0 to 32.
  2. Read the result: Subnet mask; the panel also shows Wildcard mask, Total addresses in the block and Usable host addresses.

How this calculator works

A CIDR prefix /n keeps the first n of the 32 bits of an IPv4 address for the network, so a block holds 2^(32 − n) addresses (RFC 4632, Classless Inter-domain Routing, rfc-editor.org, read 2026-10-27). The subnet mask has n one-bits followed by zeros; the wildcard mask is its bitwise inverse.

Usable hosts = 2^(32 − n) − 2, because the first address names the network and the last is the broadcast address. A /31 on a point-to-point link uses both addresses (RFC 3021), and a /32 is a single host route.

The formula

  1. M=round⁡(p)
Symbols used in the formula
SymbolMeaning
pPrefix length (the number after the slash, 0 to 32)
MSubnet mask
round(x, d)x rounded to d decimal places, or to a whole number without d.

Worked example

Prefix length (the number after the slash, 0 to 32)24
Wildcard mask0.0.0.255
Total addresses in the block256
Usable host addresses254
  1. M=round⁡(24)=24

Subnet mask 255.255.255.0 (/24)

Each step uses the unrounded value of the step before it; figures on this page are rounded for display.

Frequently asked questions

How many hosts are in a /24?

256 addresses, of which 254 can be given to hosts.

What is the subnet mask for /26?

255.255.255.192, with 64 addresses and 62 usable hosts.

What does /32 mean?

A single address: RFC 4632 calls it a host route.

Related calculators