Subnet mask converter: /24 to 255.255.255.0 and back
Type /24, 255.255.255.0 or even a wildcard mask. The tool shows all three forms and the host counts.
Three ways to write the same thing
| Prefix | Subnet mask | Wildcard mask |
|---|---|---|
| /8 | 255.0.0.0 | 0.255.255.255 |
| /16 | 255.255.0.0 | 0.0.255.255 |
| /24 | 255.255.255.0 | 0.0.0.255 |
| /26 | 255.255.255.192 | 0.0.0.63 |
| /30 | 255.255.255.252 | 0.0.0.3 |
The prefix length counts the ones at the start of the mask. The subnet mask writes those 32 bits as four numbers. The wildcard mask is the same bits turned upside down, which is what some router commands and access lists expect.
Why masks look like 192, 224, 240
A mask is ones followed by zeros. In one byte, the possible values are 0, 128, 192, 224, 240, 248, 252, 254 and 255. These are the only legal numbers in the "changing" byte of a mask. If a number like 250 appears, the mask is wrong.
How to do it by hand
For a prefix of /26: 26 ones means the first three bytes are all ones (24 bits), and 2 more ones in the fourth byte: 11000000, which is 128 + 64 = 192. So the mask is 255.255.255.192. The number of host bits is 32 - 26 = 6, so the block has 2^6 = 64 addresses.
Common mistakes
- Using a mask with gaps (255.0.255.0). It is not valid for subnetting.
- Mixing mask and wildcard. A router access list that wants a wildcard will behave strangely with a mask.
- Forgetting that more ones mean a smaller subnet. /28 is smaller than /24.
Is /31 or /32 a valid mask?
Yes. /31 is used for point-to-point links (RFC 3021), and /32 means one host.
Which form should I write in documents?
The prefix length (/26) is shortest and the most common today. Write the mask too if the reader's equipment asks for it.
This is an independent guide. It is not connected with IANA, the IETF or any network equipment maker. Address and port data come from the IANA registries as fetched on 14 November 2026; RFC texts were read from rfc-editor.org. Check the originals for anything you rely on.