How to calculate Subnet mask, Calculate Variable Length Subnet Mask (VLSM)

Few week back I face one confusion when one of our client require to increase their company computer from 200 to 1000’s PC, in the near future. They require to change the subnet mask in all their computer, server, and manageable switch. The client currently are using for their subnet mask, and require to change it to I have to assist them to change the setting in their 3Com manageable switches. I was confuse, why set to 252 instead of 255?

After Re-attend my CCNA class, CCNA in Penang, I understand how this work and also get the method on how to calculate subnet mask.

Normally for class C IP address, we will put the subnet mask as, but some other case, they are putting,,…. So when will use 128 or 192 or 225…. as your subnet mask?

For example, We use 128 (, when we require not more then 126’s PC in the network.

Method to calculate subnet mask
For, Binary is 11111111.1111111.11111111.10000000, we categories this binary as ,

NetID: 1 (1’s One)

HostID: 7 (7’s Zero)

How many PCs:

Formula: 2^ HostID -2= PC s

How many PC: 2^7-2=126 PC

How many Network:

Formula: 2^NetID=Network

How many Network: 2^1=2

Below are the table on calculate subnet mask for: (Max 126’s PC) (Max 62’s PC) (Max 30’s PC)

255.255.255. 240 (Max 14’s PC)

255.255.255. 248 (Max 6’s PC)

255.255.255. 252 (Max 2’s PC)

255.255.255. 254 (Serial subnet mask)

IT Engineer’s Life Experience
As above situation in my client side, they need 1000 PC’s, base on the formula above stated,

How many PCs:

Formula: 2^ HostID -2=number of PC

2^ ? =1024

2^10 =1024

HostID =10 (10’s zero)

The binary code for the subnet mask should be :


or we use as the subnet mask in the network that we need 1000’s PC

Base on the above diagram, subnet mask quick reference, you are able to decide what is the subnet mask that suitable your company or your network need.

Example your computer require 4000’s PC, refer to the MAX HOST above, look for the 4096 Max Host, and the subnet mask are without calculate subnet mask manually.

As above experience on my client side networking setting, now I know how to use suitable setting for the subnet mask in the future. Feel free to download the subnet mask quick reference and also copy down the above example on how to calculate subnet mask manually.