Subnetcalculator

Subnet Mask Calculator

Paste a subnet mask, CIDR prefix, wildcard mask, or a host count — the format is detected automatically and every equivalent is shown at once.

Subnet Mask Calculator

Subnet mask

The format is auto-detected — paste a dotted mask, a CIDR prefix, a wildcard mask, or type a number of hosts you need.

All Representations

CIDR
/22
Subnet Mask
255.255.252.0
Wildcard Mask
0.0.3.255
Usable Hosts
1,022
Binary breakdown
Subnet mask
11111111.11111111.11111100.00000000
Wildcard mask
00000000.00000000.00000011.11111111
Network bits
22
Host bits
10
Total addresses
1,024

Full /0–/32 Reference Table

CIDR prefixes /0 to /32 with subnet mask, wildcard mask, total and usable hosts
CIDR Subnet Mask Wildcard Mask Total Usable
/0 0.0.0.0 255.255.255.255 4,294,967,296 4,294,967,294
/1 128.0.0.0 127.255.255.255 2,147,483,648 2,147,483,646
/2 192.0.0.0 63.255.255.255 1,073,741,824 1,073,741,822
/3 224.0.0.0 31.255.255.255 536,870,912 536,870,910
/4 240.0.0.0 15.255.255.255 268,435,456 268,435,454
/5 248.0.0.0 7.255.255.255 134,217,728 134,217,726
/6 252.0.0.0 3.255.255.255 67,108,864 67,108,862
/7 254.0.0.0 1.255.255.255 33,554,432 33,554,430
/8 255.0.0.0 0.255.255.255 16,777,216 16,777,214
/9 255.128.0.0 0.127.255.255 8,388,608 8,388,606
/10 255.192.0.0 0.63.255.255 4,194,304 4,194,302
/11 255.224.0.0 0.31.255.255 2,097,152 2,097,150
/12 255.240.0.0 0.15.255.255 1,048,576 1,048,574
/13 255.248.0.0 0.7.255.255 524,288 524,286
/14 255.252.0.0 0.3.255.255 262,144 262,142
/15 255.254.0.0 0.1.255.255 131,072 131,070
/16 255.255.0.0 0.0.255.255 65,536 65,534
/17 255.255.128.0 0.0.127.255 32,768 32,766
/18 255.255.192.0 0.0.63.255 16,384 16,382
/19 255.255.224.0 0.0.31.255 8,192 8,190
/20 255.255.240.0 0.0.15.255 4,096 4,094
/21 255.255.248.0 0.0.7.255 2,048 2,046
/22 255.255.252.0 0.0.3.255 1,024 1,022
/23 255.255.254.0 0.0.1.255 512 510
/24 255.255.255.0 0.0.0.255 256 254
/25 255.255.255.128 0.0.0.127 128 126
/26 255.255.255.192 0.0.0.63 64 62
/27 255.255.255.224 0.0.0.31 32 30
/28 255.255.255.240 0.0.0.15 16 14
/29 255.255.255.248 0.0.0.7 8 6
/30 255.255.255.252 0.0.0.3 4 2
/31 255.255.255.254 0.0.0.1 2 2
/32 255.255.255.255 0.0.0.0 1 1

Have a full IP address to plan around instead of just a mask? Use the general subnet calculator · Working from CIDR notation? Try the CIDR calculator · Need Cisco ACL and OSPF examples? See the wildcard mask calculator

What a subnet mask does

A subnet mask is a 32-bit value that tells a device which portion of an IP address is the network and which portion identifies the host. Written in dotted-decimal, each bit set to 1 marks a network bit and each bit set to 0 marks a host bit — 255.255.255.0 is 24 one-bits followed by 8 zero-bits, which is exactly what /24 means in CIDR notation. Devices AND the mask against an address to find its network address, and that comparison is how routing and subnet membership get decided.

A valid mask must follow the contiguous-bits rule: all the 1-bits come first, then all the 0-bits, with no mixing. 255.255.255.128 is valid (25 ones then 7 zeros). 255.255.255.253 is not, because 253 is 11111101 in binary — a 0-bit breaks up the run of 1s. And 255.255.255.256 is invalid for an even simpler reason: 256 doesn't fit in a single octet, which only holds values 0–255.

Mask vs. wildcard mask

A wildcard mask is the bitwise inverse of a subnet mask, and it shows up in a different context: Cisco IOS access control lists and OSPF network statements use wildcard masks instead of subnet masks. Where a subnet mask's 1-bits mean "network portion," a wildcard mask's 0-bits mean "must match exactly" and its 1-bits mean "don't care." The mask 255.255.255.0 and the wildcard 0.0.0.255 describe the same /24 boundary — this calculator converts either direction automatically. For ACL and OSPF command examples specifically, see the wildcard mask calculator.

Subnet Mask Calculator FAQ

What subnet mask do I use for 500 hosts?

255.255.252.0, also written /22. It provides 1,022 usable addresses, the smallest standard block that covers 500 hosts (a /23 only gives 510, which is enough too — but 500 is close enough to that boundary that most engineers size up to /22 for headroom). Type "500 hosts" into the calculator above and it picks the right prefix automatically.

What is 255.255.255.0 in CIDR?

/24. The mask 255.255.255.0 has 24 one-bits followed by 8 zero-bits (11111111.11111111.11111111.00000000), and CIDR notation is just a count of those leading one-bits. /24 gives 256 total addresses and 254 usable hosts once the network and broadcast addresses are set aside.

What's the difference between a subnet mask and a wildcard mask?

They're bitwise inverses of each other. A subnet mask uses 1-bits for "this is the network portion" and 0-bits for the host portion (255.255.255.0). A wildcard mask, used in Cisco ACLs and OSPF network statements, flips that: 0-bits mean "must match" and 1-bits mean "don't care" (0.0.0.255 for the same /24). The wildcard mask calculator covers ACL and OSPF examples in more depth.

Can a subnet mask be 255.255.255.253?

No. A valid subnet mask must be a contiguous run of 1-bits followed by a contiguous run of 0-bits. 253 in binary is 11111101 — a 0-bit sits in the middle of 1-bits, which breaks the contiguous-bits rule. Masks like that are rejected as invalid rather than silently rounded to something nearby.

Need to convert a whole IP address to binary, hex, or integer form too? The IP converter handles that.

More Network Tools

Free tools for network engineers — no signup, no rate-limit walls.