subnet mask to CIDR

Subnet Mask to CIDR Converter

Turn a conventional dotted-decimal IPv4 subnet mask into CIDR notation and verify the resulting network size. CIDR is simply the count of consecutive network bits in a valid contiguous mask.

subnet mask to CIDRmask to CIDR convertersubnet mask converter255.255.255.0 CIDR
IPv4 / VISUAL ENGINE LOCAL COMPUTE
IP addressVALID
Network / host boundary24 : 8
/0drag the boundary/32
1234567891011121314151617181920212223242526272829303132
Network bitsHost bits
256TOTAL ADDRESSES
192.168.1.0/24
Network address192.168.1.0
Broadcast address192.168.1.255
Usable host range192.168.1.1 — 192.168.1.254
Subnet mask255.255.255.0
Wildcard mask0.0.0.255
Usable hosts254

Convert a subnet mask to CIDR

Count the consecutive one-bits in the binary subnet mask. A mask of 255.255.255.0 contains 24 leading one-bits and is therefore /24.

Valid conventional subnet masks are contiguous: all one-bits appear before all zero-bits. Non-contiguous masks do not have a standard CIDR prefix equivalent.

Common mask-to-CIDR conversions

255.255.0.0 is /16; 255.255.255.0 is /24; 255.255.255.128 is /25; 255.255.255.192 is /26; 255.255.255.224 is /27; 255.255.255.240 is /28; 255.255.255.248 is /29; and 255.255.255.252 is /30.

Why CIDR notation is useful

CIDR is compact and unambiguous, so it is commonly used in routing tables, firewall rules, cloud VPCs and infrastructure-as-code. Writing 10.0.0.0/16 is shorter than pairing 10.0.0.0 with 255.255.0.0.

Check the host capacity too

Once you know the prefix, subtract it from 32 to find the host-bit count. A /26 leaves six host bits and therefore provides 64 total addresses.

What this calculator shows

The result panel reports the canonical network address, broadcast address, first and last conventional usable addresses, dotted-decimal subnet mask, wildcard mask, total IPv4 address count and usable-host count. The live 32-bit boundary updates with the CIDR prefix, so the relationship between prefix length, block size and address capacity is visible instead of hidden behind a static table.

How to read the result correctly

The calculator normalizes the IP address you enter to the network block that contains it. That means an input such as 192.168.1.42/24 correctly resolves to network 192.168.1.0/24. For prefixes /0 through /30, conventional IPv4 subnetting reserves the first address as the network identifier and the final address as broadcast. /31 and /32 have different practical semantics, so their address counts should not be interpreted with the ordinary “subtract two” rule.

Related subnet tools

You can also use the subnetting cheat sheet for a complete IPv4 prefix reference, browse individual CIDR prefix pages, try the IPv6 subnet calculator, or return to the main visual subnet calculator.

Frequently asked questions

What CIDR is 255.255.255.0?

255.255.255.0 is /24.

What CIDR is 255.255.255.192?

255.255.255.192 is /26.

What CIDR is 255.255.255.252?

255.255.255.252 is /30.