Udemy logo

how to subnetIP is the dominant network protocol in use today in both Local Area Networks (LANs) and on the Internet. However, IPv4 addressing is anything but simple. Too often, IP subnetting is a source of confusion even for experienced technicians. However, it is an inescapable fact that most networks will require subnetting for optimization and security purposes.

Learn how to work with subnets and TCP/IP networks

What are Subnets?

The practice of sub-dividing a network into multiple sub-networks is called subnetting. It is achieved by clever manipulation of the IP address and its corresponding subnet mask.

An IP address is in the format;

IP Address Range (N= Network, H = Host)


Subnet Mask










D & E

Multicast &reserved

In the table above, the IP address components are designated as network or host bits, the subnet mask designates the boundaries. For example, for a class A network the mask is an /8, a class B is a /16, and a class C is /24. These demarcations points are commonly represented by decimal notation such as, or either way they mark the boundaries of what is a network and what is a host.

Learn more on the fundamentals of inter-networks!

So, how do professionals manage to calculate subnets and masks in their head? Well, they think in decimal, not binary. They do this by extending the subnet mask by borrowing host bits from the designated host range. For example, a single address range can be split into two by extending the subnet mask by borrowing one bit, transforming the subnet mask from a /24 to a /25 or a in decimal notation. The table below outlines the options achievable by borrowing host bits to extend the subnet mask.

Subnet mask

No of Subnets

No of Hosts per subnet




254   (256 -2)



126   (128 -2)

Large departments


62     (64 -2)

Medium Large dept


30     (32 -2)

Medium departments


14     (16 -2)

Small departments


6       (8 -2)

ADSL Connections


2       (4-2)

WAN LINK / Point-to -Point

Regardless of what address range is used, class A, B or C, it is possible to use basic math to subnet. The individual subnets and hosts can be determined through two basic formulas.

  1. Number of subnets = 2n where n is the number of bits borrowed to make the subnet mask
  2. Number of hosts = 2(32 – n) – 2 where n is the number of bits in your subnet mask

For example, what subnet does the host IP belong too?

The mask is a /27. So next demarcation boundary is 32, it is greater than boundary 24 but less than 32. Therefore by applying the formula,

Number of hosts = 2(32 – n) – 2 we can easily determine its subnet.

Explanation – to determine the number of hosts per subnet, the value of n is equal to the length of the subnet mask. In the example above, the formula is thirty-two (the class boundary) minus twenty-seven (the subnet mask) therefore (32 – 27) = 5. It follows that 25 = 32 which gives us our block size – the number of hosts per subnet. However, two addresses are unavailable for use as host addresses, namely the first and last addresses. The first address of a subnet identifies the subnet and the last indicates the subnet broadcast address, which is used to communicate with all hosts in that subnet, hence the -2 in the formula.

Now, it is simply a case of counting from zero upwards in the fourth octet using the previously determined host block size, which in this case is 32.

1st Subnet –

2nd Subnet –  (The host belongs to this subnet)

Its subnet address is and it broadcast address is, it is important to remember that a subnet always starts with an even number and the broadcast with an uneven number.

The rules apply not just to Class C addresses but to the other classes as well, here is an example of a Class B borrowing bits in the third octet.

What subnet does belong too?

The mask is 19 so 24 is the closest boundary therefore (24 – 19) =5, so  2^5 = 32

Counting up from zero using the host block size of 32, but this time in the third octet, has in the 4th subnet, it will have a subnet address of and a broadcast address of

1st subnet

2nd subnet

3rd subnet

4th subnet ( belongs in this subnet)

5th subnet

How to Subnet Quickly and Efficiently like the Professionals

128  64 32 16  8   4   2 0
 0   0   0  0  0  0  0  0

1.      Number of subnets = 2n where n is the number of bits borrowed to make the subnet mask

2.      Number of hosts = 2(32 – n) – 2 where n is the number of bits in your subnet mask

These are the quick tips professionals use to calculate subnets, hosts and an IP address’ home network. If you wish to further investigate advanced IP design topics, then IP subnetting and address planning is just the start on the journey towards being an expert IP network designer.

Page Last Updated: April 2014

Network Administration students also learn

Empower your team. Lead the industry.

Get a subscription to a library of online courses and digital learning tools for your organization with Udemy Business.

Request a demo