CIDR to subnet mask

CIDR to Subnet Mask Converter

Convert any IPv4 CIDR prefix into its dotted-decimal subnet mask. Move the prefix control and the matching mask, wildcard mask, address count and network/host boundary update instantly.

CIDR to subnet maskCIDR to mask converterCIDR converterprefix to subnet mask
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

How CIDR converts to a subnet mask

Each CIDR prefix represents a run of one-bits followed by zero-bits in a 32-bit subnet mask. /24 is twenty-four ones followed by eight zeros, which converts to 255.255.255.0.

The conversion is deterministic: /25 is 255.255.255.128, /26 is 255.255.255.192, /27 is 255.255.255.224, /28 is 255.255.255.240 and /30 is 255.255.255.252.

Fast conversion method

Every full 8 network bits produces an octet of 255. The remaining partial octet can be read from the sequence 0, 128, 192, 224, 240, 248, 252, 254, 255. For example, /20 has two full octets plus four network bits in the third octet, producing 255.255.240.0.

CIDR and address capacity

Converting the prefix also reveals the number of host bits. A /24 leaves 8 host bits, /28 leaves 4 and /30 leaves 2. Total addresses are calculated as 2 raised to the number of host bits.

Use the full prefix reference

For frequent network planning, the subnetting cheat sheet lists every IPv4 prefix alongside its subnet mask, wildcard mask, total address count and conventional usable-host count.

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 subnet mask is /24?

/24 is 255.255.255.0.

What subnet mask is /30?

/30 is 255.255.255.252 and contains 4 total IPv4 addresses.

Can every subnet mask be written as CIDR?

Every conventional contiguous subnet mask can be represented as CIDR. Non-contiguous masks do not have a standard CIDR prefix equivalent.