Converted between dotted decimal subnet masks and prefix notation

You are reading a network diagram and you see a slash notation subnet mask such as /19. The easiest way to convert to dotted decimal is to divide the number by 8 e.g. 19 divided by 8 is 2 with a remainder of 3.

The 2 equates to the number of 255s and will either be 1, 2 or 3 for proper subnets.

The remainder will be one of the following:

0 - 0
1 - 128
2 - 192
3 - 224
4 - 240
5 - 248
6 - 252
7 - 254

Using the example above, the remainder 3 is equal to 224 so the complete subnet for a /19 is 255.255.224.0

/28 = (28 / 8 = 3 remainder 4 so /28 = 255.255.255.240).

To reverse the conversion, from dotted decimal back to prefix notation, remember that each block of 255 = 8 then add on the extra reading the above table from right to left e.g. 255.192.0.0 = (1 x 8) + 2 = /10

Thanks for the contribution, Mark!