CIDR to Netmask Converter

Convert a CIDR prefix length to a dotted-decimal netmask, or go the other way, and see the wildcard mask and address count.

Type a prefix length such as 24, or a netmask such as 255.255.255.0.

Prefix /24

255.255.255.0

  • CIDR prefix/24
  • Netmask255.255.255.0
  • Wildcard mask0.0.0.255
  • Total addresses256
  • Usable hosts254
  • Read 255.255.255.0 as a netmask and counted 24 leading one bits.

How it works

netmask = 32 bits with the first n bits set; wildcard = NOT netmask

Sources

  • RFC 4632 — CIDR Address Strategy (2006)
  • RFC 950 — Internet Standard Subnetting Procedure (1985)

Questions

What is the difference between a netmask and a wildcard mask?

A netmask has 1s where the address must match the network and 0s for host bits. A wildcard mask inverts that, so 0 means "must match" and 1 means "any value".

Which prefixes have no usable hosts?

None are unusable, but the arithmetic changes: /30 and shorter reserve the network and broadcast addresses, /31 is a two-address point-to-point link, and /32 is a single address.