Subnet Mask Calculator
Convert a CIDR prefix length into its dotted-decimal subnet mask, wildcard mask and usable host count.
Inputs
Subnet Mask
255.255.255.0
Wildcard Mask
0.0.0.255
Addresses in Block
256
Usable Hosts
254
Step by step
Values used
Prefix length (CIDR) = 24 bits
Subnet Mask
The mask is the 32-bit value whose leading p bits are 1; usable hosts = 2^(32 − p) − 2.
Subnet Mask
= 255.255.255.0
Wildcard Mask
= 0.0.0.255
Addresses in Block
= 256
Usable Hosts
= 254
How it works
A prefix length says how many leading bits belong to the network. Setting those bits to 1 and the rest to 0 gives the subnet mask; inverting it gives the wildcard mask used in ACLs. Two addresses in each block are reserved for the network and broadcast addresses, except /31 (point-to-point) and /32 (host route). Every switch, router, firewall and DHCP scope wants the mask in a different notation, and a mask that is one bit off silently blackholes half a subnet.
Formula
Subnet Mask
The mask is the 32-bit value whose leading p bits are 1; usable hosts = 2^(32 − p) − 2.
- p
- CIDR prefix length in bits
- mask
- Dotted-decimal subnet mask
Guides that use this calculator
Frequently Asked Questions
How is Subnet Mask calculated?
The mask is the 32-bit value whose leading p bits are 1; usable hosts = 2^(32 − p) − 2. A prefix length says how many leading bits belong to the network. Setting those bits to 1 and the rest to 0 gives the subnet mask; inverting it gives the wildcard mask used in ACLs. Two addresses in each block are reserved for the network and broadcast addresses, except /31 (point-to-point) and /32 (host route).
Why does Subnet Mask matter?
Every switch, router, firewall and DHCP scope wants the mask in a different notation, and a mask that is one bit off silently blackholes half a subnet.
What values do I need to enter?
This calculator takes 1 input: Prefix length (CIDR). The pre-filled defaults are a realistic starting point — replace them with figures from your own environment for a result you can act on.