Subnet Mask to CIDR Conversion Table
Convert between subnet masks and CIDR notation with a complete reference table. Learn the relationship between dotted decimal masks and prefix lengths.
255.255.255.0/24CalculationDetailed Explanation
Subnet Mask to CIDR Conversion
Converting between subnet masks (dotted decimal) and CIDR prefix lengths (slash notation) is a fundamental networking skill. Both representations convey the same information — how many bits define the network portion of an address.
Complete Conversion Table
Here are the most commonly used conversions:
| CIDR | Subnet Mask | Usable Hosts |
|---|---|---|
| /8 | 255.0.0.0 | 16,777,214 |
| /12 | 255.240.0.0 | 1,048,574 |
| /16 | 255.255.0.0 | 65,534 |
| /20 | 255.255.240.0 | 4,094 |
| /21 | 255.255.248.0 | 2,046 |
| /22 | 255.255.252.0 | 1,022 |
| /23 | 255.255.254.0 | 510 |
| /24 | 255.255.255.0 | 254 |
| /25 | 255.255.255.128 | 126 |
| /26 | 255.255.255.192 | 62 |
| /27 | 255.255.255.224 | 30 |
| /28 | 255.255.255.240 | 14 |
| /29 | 255.255.255.248 | 6 |
| /30 | 255.255.255.252 | 2 |
| /31 | 255.255.255.254 | 2 (P2P link) |
| /32 | 255.255.255.255 | 1 |
How to Convert Manually
Mask to CIDR: Convert each octet to binary and count the consecutive 1s. For example, 255.255.255.192 = 11111111.11111111.11111111.11000000 = 26 ones = /26.
CIDR to Mask: Write the prefix length as consecutive 1s, pad with 0s to 32 bits, then convert each 8-bit group to decimal. /20 = 11111111.11111111.11110000.00000000 = 255.255.240.0.
Quick Mental Math
For the last octet, memorize these values: 128 (/25), 192 (/26), 224 (/27), 240 (/28), 248 (/29), 252 (/30), 254 (/31), 255 (/32). Each adds one more bit to the network portion.
Usable Hosts Formula
The number of usable hosts is calculated as: 2^(32 - prefix) - 2. The subtraction of 2 accounts for the network address and the broadcast address.
Use Case
A junior network administrator references the conversion table while configuring router interfaces that require subnet masks in dotted decimal format.
Try It — Subnet Calculator
Related Topics
CIDR Notation Explained: How IP Addressing Works
10.0.0.0/16 · Concept
/24 Subnet (255.255.255.0)
192.168.1.0/24 · IPv4
Network vs. Host Portion of an IP Address
192.168.1.0/24 · Concept
How to Calculate a Broadcast Address
192.168.1.0/24 · Calculation
Wildcard Masks in Networking Explained
0.0.0.255 · Calculation
VLSM: Variable Length Subnet Masking Explained
10.1.0.0/16 · Concept