Paritian

Work & Productivity

Subnet Mask Calculator

Usable hosts, total addresses and the four octets of the subnet mask for a CIDR prefix.

Results

Usable hosts 62
Total addresses 64
Mask octet 255
Mask octet 255
Mask octet 255
Mask octet 192
Subnets in a /24 4

What this tool does

The prefix is how many bits from the left are fixed by the network, so a bigger number means a smaller subnet — which catches people out constantly. A /24 is the familiar 255.255.255.0 with 254 hosts; a /26 quarters it. The last result counts how many subnets of that size fit inside one /24.

Formula

machines = 2^(32 − prefix) − 2

Variables

SymbolMeaningUnit
pfPrefix length (CIDR)
HSUsable hosts
ADTotal addresses
M1Mask octet
M2Mask octet
M3Mask octet
M4Mask octet
SNSubnets in a /24

Worked example

  • Prefix length (CIDR)26
  • Usable hosts62
  • Total addresses64
  • Mask octet255
  • Mask octet255
  • Mask octet255
  • Mask octet192
  • Subnets in a /244

Limitations

  • For work that must comply with a standard or be signed off, check the result against the applicable code and have it reviewed by a qualified engineer.
  • The calculation runs at full precision and only the display is rounded. If you copy an intermediate value and retype it, small differences can appear.

Frequently asked questions

Why subtract two from the host count?

Because two addresses in every ordinary subnet are reserved: the first, with all host bits zero, names the network itself, and the last, with all host bits one, is the broadcast address. Neither can be given to a machine. That is why a /30 — four addresses — gives only two usable ones, which is exactly enough for the two ends of a point-to-point link, and why /31 exists as a special case for that job without the waste.