About subnet mask calculator
A subnet mask marks which part of an IP address is the network. It can be written as a prefix like /24 or as dotted decimal 255.255.255.0.
Converting
- /8 = 255.0.0.0.
- /16 = 255.255.0.0.
- /24 = 255.255.255.0.
- /26 = 255.255.255.192.
Runs in your browser
Calculations on this page happen on your device. Nothing you enter is uploaded.
A worked example
The prefix /27 means 27 network bits, so the mask is 255.255.255.224, there are 32 addresses and 30 usable hosts. The mask 255.255.240.0 is /20, with 4,096 addresses. Converting is simply counting the 1 bits in the mask.
Why it matters
- A wrong mask can make hosts unable to reach each other.
- Routers and firewalls use the mask to decide what is local.
- Use consistent masks inside a subnet.
Wildcard masks
Routers and firewalls sometimes use the inverse of a subnet mask, called a wildcard mask. For 255.255.255.0 the wildcard mask is 0.0.0.255.
