Skip to main content
KalkuNet

Subnet Mask to CIDR Converter — 255.255.255.0 Becomes /24

Convert dotted netmask (e.g. 255.255.248.0) into /prefix, binary & wildcard.

Runs in your browserNetwork · Subnetting, CIDR & Network Maths
InputPrefixWildcardHosts per subnet
255.255.255.0/240.0.0.255254
255.255.248.0/210.0.7.2552,046
255.255.255.252/300.0.0.32
255.0.0.0/80.255.255.25516,777,214
255.255.0.255✗ the 1 bits are not contiguous — not a subnet mask
  • Invalid lines are left out of the result.

When to use the Dotted-Decimal Subnet Mask to /CIDR Prefix Converter

  • Prefix, wildcard and hosts

    Every mask becomes a prefix length, an ACL wildcard mask and the hosts per subnet, handy when moving old configs to devices that use CIDR notation. For example 255.255.255.192 becomes /26 with wildcard 0.0.0.63 and 62 hosts per subnet.

  • Invalid masks refused

    A mask must be a run of 1 bits followed by 0 bits. Values such as 255.255.0.255 are refused with an explanation, because they cannot work as a subnet mask.

  • Lists from old configs

    Paste a mask column from router exports, DHCP or inventory spreadsheets and convert them all at once. Put each mask on its own line; lines starting with a hash are treated as comments and skipped.

  • Tested against Python

    The prefix length of every valid mask is compared with Python's ipaddress module, edge cases /0, /31 and /32 included.

Frequently asked questions

How do I get the prefix from a mask?

Count the 1 bits. For example 255.255.248.0 holds 8 + 8 + 5 one bits, so its prefix is /21.

Which masks are common?

255.255.255.0 (/24) for LANs, 255.255.255.252 (/30) for older router links and 255.255.255.254 (/31) for modern point-to-point links.

What about the reverse?

Use the CIDR to Subnet Mask converter to turn /24 into 255.255.255.0.

Does IPv6 use subnet masks?

No; IPv6 only uses prefix lengths such as /64. The standard IPv6 LAN subnet is /64, because SLAAC needs a 64-bit interface ID.

Is my data sent to a server?

No. Everything is computed in your browser, so the device configs you paste are not sent anywhere.

Learn more