A net mask also known as subnet mask is just an alternative old way of writing the prefix length. This is simply a one for a prefix bit and a zero for a host bit. Hence you would have a netmask written as n times ones followed by 32 minus n times zero. For example a slash 27 prefix will be written as 27 ones followed by five zeros. Decimal representation for this would be 255.255.255. How did we get to 224? Remember a slash 27 is 27 ones followed by five zeros because an ipv4 address has 32 bits. So how did we get to 224? We get this by simply subtracting 2 to the power of number of host bits, in this case is 32 minus 27 from 256. This is the same as 256 minus 2 to the power of 5 which is 256 minus 32 which is 224. An alternative way of doing this is what we had shown you earlier with the IP addresses. This would be converting the last eight bits which is one one one followed by five zeros, directly from binary to decimal, you would also arrive at 224. So what would be the netmask for a slash 26 and a slash 28? For a slash 26 it would be the same thing, it would be 256 minus 2 to the power of 32 minus 26 which would be 256 minus 2 to the power of 6 which is going to be 256 minus 64. And that would give you 192 at the netmask for a slash 28. It's going to be the same thing you would have 256 minus 2 to the power of 32 minus 28 which would be 256 minus 2 to the power of 4. It's the same as 256 minus 16 and that would give you 240. So for the netmask for slash 28 would be and the netmask or slash 26 would be You can look at a netmask table using the links shown on the screen. This would give you a good reference guide of the different prefixes and their conversion to netmask.

© Produced by Philip Smith and the Network Startup Resource Center, through the University of Oregon.

Attribution-NonCommercial 4.0 International (CC BY-NC 4.0)
This is a human-readable summary of (and not a substitute for) the license. Disclaimer. You are free to: Share — copy and redistribute the material in any medium or format Adapt — remix, transform, and build upon the material The licensor cannot revoke these freedoms as long as you follow the license terms. Under the following terms: Attribution — You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use. NonCommercial — You may not use the material for commercial purposes. No additional restrictions — You may not apply legal terms or technological measures that legally restrict others from doing anything the license permits.