Switch in either direction between a CIDR prefix (/24) and a dotted-decimal subnet mask (255.255.255.0). The tool also derives the wildcard mask and the number of usable hosts, making it a quick reference when configuring routers, firewalls, and IP plans.
How it works
A subnet mask is just a run of leading 1 bits followed by 0 bits:
- Prefix to mask: set the first
pbits to 1. For/24that is11111111.11111111.11111111.00000000=255.255.255.0. - Mask to prefix: count the leading 1 bits — but only if they are contiguous. A mask like
255.0.255.0is rejected because its 1 bits are not all on the left. - Wildcard mask = bitwise NOT of the subnet mask, e.g.
0.0.0.255for a/24. - Usable hosts =
2^(32 − p) − 2, subtracting the network and broadcast addresses.
Example
Converting /26:
- Mask =
255.255.255.192 - Wildcard =
0.0.0.63 - Usable hosts =
2^(32 − 26) − 2 = 2^6 − 2 = 62
| Prefix | Subnet mask | Wildcard | Usable hosts |
|---|---|---|---|
| /24 | 255.255.255.0 | 0.0.0.255 | 254 |
| /26 | 255.255.255.192 | 0.0.0.63 | 62 |
| /30 | 255.255.255.252 | 0.0.0.3 | 2 |
Everything runs in your browser; nothing is uploaded.