IP Subnet Calculator · Practical guide

CIDR to Subnet Mask Conversion

The CIDR number counts the 1-bits in the mask — /24 means 255.255.255.0. Full table below.

At a glance

How the Conversion Works

A CIDR prefix is simply the count of consecutive 1-bits at the start of the 32-bit subnet mask. Write that many ones, pad with zeros to 32 bits, and group into four octets: /24 = 11111111.11111111.11111111.00000000 = 255.255.255.0. The calculator above shows the dotted-decimal mask — and its inverse, the wildcard mask — for any prefix from /0 to /32.

Interactive tool

IP Subnet Calculator

Enter your own values, then compare the result with the examples below.

Subnet Details

Network Address-
Broadcast Address-
First Usable Host-
Last Usable Host-
Number of Hosts-
Subnet Mask-
Wildcard Mask-
IP Class-

CIDR to Subnet Mask Lookup Table

CIDRSubnet MaskWildcard MaskUsable Hosts
/8255.0.0.00.255.255.25516,777,214
/16255.255.0.00.0.255.25565,534
/24255.255.255.00.0.0.255254
/25255.255.255.1280.0.0.127126
/26255.255.255.1920.0.0.6362
/27255.255.255.2240.0.0.3130
/28255.255.255.2400.0.0.1514
/29255.255.255.2480.0.0.76
/30255.255.255.2520.0.0.32

Converting in the Other Direction

To go from a mask to CIDR, count the 1-bits. 255.255.255.240 has three full octets (24 bits) plus 11110000 (4 more), so it's /28. Handy anchors for the last octet: 128, 192, 224, 240, 248, 252, 254, 255 correspond to 1 through 8 extra bits.

What the Wildcard Mask Is For

The wildcard mask is the bitwise inverse of the subnet mask — every 0 becomes 1 and vice versa, so /26's mask 255.255.255.192 flips to 0.0.0.63. Wildcard masks appear in Cisco access control lists and OSPF configuration, where the 1-bits mark positions that may vary. Whenever you need one, enter the prefix in the calculator and read it straight from the results.

Frequently Asked Questions

What subnet mask is /27?

255.255.255.224. The first 27 bits are ones: three full octets (24 bits) plus 11100000 in the last octet, which equals 224. A /27 provides 30 usable host addresses.

Why did CIDR replace classful addressing?

Classful addressing forced networks into huge Class A, B, or C blocks, wasting addresses. CIDR lets prefixes fall on any bit boundary, so an organization that needs 500 addresses gets a /23 instead of an entire /16.

What is a /0 mask?

0.0.0.0 — zero network bits, meaning it matches every IPv4 address. It appears in routing tables as the default route, written 0.0.0.0/0.

Does every device need to know the subnet mask?

Yes. Hosts use the mask to decide whether a destination is on the local subnet (deliver directly) or remote (send to the default gateway). A wrong mask causes unreachable-host errors even when the network is fine.