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
CIDR to Subnet Mask Lookup Table
| CIDR | Subnet Mask | Wildcard Mask | Usable Hosts |
|---|---|---|---|
| /8 | 255.0.0.0 | 0.255.255.255 | 16,777,214 |
| /16 | 255.255.0.0 | 0.0.255.255 | 65,534 |
| /24 | 255.255.255.0 | 0.0.0.255 | 254 |
| /25 | 255.255.255.128 | 0.0.0.127 | 126 |
| /26 | 255.255.255.192 | 0.0.0.63 | 62 |
| /27 | 255.255.255.224 | 0.0.0.31 | 30 |
| /28 | 255.255.255.240 | 0.0.0.15 | 14 |
| /29 | 255.255.255.248 | 0.0.0.7 | 6 |
| /30 | 255.255.255.252 | 0.0.0.3 | 2 |
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.