Understanding Subnetting

In order to understand subnet masks, you MUST understand binary.   If you already have a basic understanding of binary, you can skip ahead to the “Networks and Subnetting” section further down below.

Understanding Binary

The math that you and I and every other person on the planet uses in our day-to-day activities is base-10.  This means our number system is based on 10 individual digits, 0 through 9, and subsequently powers of 10.

Lets take the number one hundred twenty three (123).  It has three “places”, the hundreds place, the tens place, and the ones place.  Simple, I know, but it is necessary to relate to binary.  In the hundreds place, we have the value of 1, the tens place a value of 2, and the ones place a value of 3.

Now we get to the fun part.  The hundreds, tens, and ones place are more technically the 10^2 place, 10^1 place, and 10^0 place (that’s ten to the power of 2, etc.).  Ten to the power of 2 is 100, to the power of 1 is 10, and to the power of 0 is 1 (anything to the power of 0 is 1).So what this means, is that for every place, the value added to the final number is the number in that place, times the appropriate 10^x.  In this example, then:

(1 * 10^2) = 1 * 100 = 100
(2 * 10^1) = 2 * 10  =  20
(3 * 10^0) = 3 * 1   =   3

How does this relate to binary?  The only difference is binary uses base-2 instead of 10, meaning our places are 2 to the power of 0, 1, 2, 3, etc. and we only have 2 individual digits, 0 and 1.  So lets do the same number, 123, but in binary.


While the presence of only ones and zeros may seem confusing, it’s easy if you understand the value of each place, which are now 2 to the power of x, and extend the same logic as in the base-10 example.  Also, notice I chose to use 8 digits to represent the number, even though I could have omitted the first zero.  This is important for networking, as we’ll see in a minute.  The value of each place from left to right is shown below, with the appropriate 2^x designation:

2^7 = 128
2^6 = 64
2^5 = 32
2^4 = 16
2^3 = 8
2^2 = 4
2^1 = 2
2^0 = 1

In our example number of 123, converted to binary, we have a 1 in the  place values 64, 32, 16, 8, 2, and 1. Add those values together and you end up with: (64+32+16+8+2+1) = 123.  Each increasing place value from right to left is twice the previous place, or half the previous from left to right.

Networks and Subnetting

Let us move on to networking, and see how binary comes in to play along with the concept of subnetting. An IP address is made up of four “octets”, and they are called octets because…they use 8 “binary digits”, or “bits” in each number, just like the example above!  The highest value you can have in any one of the four octets is 255, because that is the highest number you can represent in binary using 8 bits.  11111111 = 255.  Try the conversion yourself: add up the values for all eight places and you’ll see it.

An IP address is useless on it’s own; it also needs a subnet mask to tell the system what network it belongs to.

Lets take a pretty standard example, then break it down. The IP address I chose for this example is one you’ll see on at least half of all consumer routers, so this is hopefully somewhat familiar to you.


The first three octets in this example are the network address, the last octet contains the host address (we’ll get to the “why” in just a second).  This doesn’t much help, or make any sense, without binary, so let’s convert it!

IP:   11000000.10101000.00000001.00000001
Mask: 11111111.11111111.11111111.00000000

That’s more like it! So, what does a subnet mask do, exactly? The subnet mask identifies which bits of the IP address compose the network and which ones make up the host.  Any bits in the subnet mask that have a 1 indicate that the corresponding bit in the IP address is part of the network.  If you look above, you’ll see that the first three octets are all 1s, meaning a change to any one of the bits in the first three octets of the IP address changes what network the host is on.  The last octet is zeros, meaning any change there is only a change to the host, but is still on the same network.

For subnetting, what does this mean?  Each network is going to use one of the host addresses for the network address; it is the lowest possible host value for a given network, so in our example the network address would be  Each network also has a broadcast address, which is the highest value for a given network, in our case  So now that we have 2 addresses for the network’s exclusive use, that leaves us with 253 usable addresses for network hosts.  This example is fairly simple, as it uses an easy to convert subnet mask with a simple network and broadcast address.  To extend this and make a larger network, let’s use a network mask of 22:

IP:   11000000.10101000.00000001.00000001
Mask: 11111111.11111111.11111100.00000000

Notice the third octet value changed by the last two bits in the octet, giving us 22 bits for our subnet mask. Now, the network address becomes since all the bits in our IP that correspond to the netmask in the 3rd octet are zeros, despite the IP address remaining the same.  This also means our broadcast address for this example is now, since that is the highest possible value we can have without changing the bits in the IP address that correspond to the netmask.  This change to the netmask has increased our available network addresses, giving us 1022 usable addresses (remember, one for network, one for broadcast).  The new address range is to Knowing the number of bits in the mask also allows us to indicate the subnet with a single number. In our last example, we could communicate our network details to someone by giving the IP of any host in the network and the number of bits in the mask: This is known as “CIDR notation”. As final note, the subnet mask will always fill in ones from left to right, and never skip bits in between with zeros, which will limit the possible subnet masks that can be assigned.

Please leave your feedback below! I’d love to answer any questions that you may have, so don’t hesitate to ask.

Leave a Reply