Calculate Subnets Using Binary: Understanding Subnetworking

Calculate Subnets Using Binary: Understanding Subnetworking
Page content

Subnet Masks

Subnet masks are the key to subnetworking and are used in all networking situations, even those that don’t have any subnets at all. If you type ipconfig /all at a command line it will tell you the IP address(s) on your network interface(s), but it will also tell you the subnet mask.

Subnet masks are expressed in the following way on non-subnetworked networks:

Class A IP Addresses: | Subnet Mask:

Class B IP Addresses: | Subnet Mask:

Class C IP Addresses: | Subnet Mask:

The “255” in the octet (thusly named from being made up of 8 bits, or 8 1’s and 0’s) means that every bit is dedicated to the network addresses (as opposed to host addresses). A Class A network has 8 network bits, B has 16 network bits, and C has 24 network bits. The amount of bits dedicated to network addressing, of course, diminishes the number of host addresses that can be used:

Class A - 16 million host addresses

Class B - 65,000 host addresses

Class C - 254 host addresses

Working With Binary

To have a clear understanding of how subnetworking works, we have to look at subnet masks in their “bit” form. The 1’s and 0’s that make them up, and are read and understood by computers.

The act of subnetting is “borrowing” a bit, or several bits, from the host octets, which is also expressed in the subnet mask. If you were to subnet a class A network, your starting subnet would be:

Expressed in binary, where we can see all the bits, it would look like this: 11111111.00000000.00000000.00000000

How do we know that without using a binary converter? It’s easy. Just like how in base 10 (our normal number scheme) there are “place’s” that mean different things, like the “ones” place, the “tens” place, the “hundreds” place (which are all multiples of, or divisible by 10) etc, binary has “place’s” too.

In binary the first bit is 1, the second is 2, the third is 4, the fifth is 8, and so on, doubling as it goes. So if we have 8 bits, their converted values would look like this:


The binary 1’s and 0’s tell us which of those places we should be counting, rather like a “6” in the “tens” place tells us it means 60. Therefore the binary number, 11111111 tells us that it actually means:

128 + 64 + 32 + 16 + 8 + 4 + 2 + 1 = 255

whereas the binary number, 10101010 means:

128 + 0 + 32 + 0 + 8 + 0 + 2 + 0 = 170

Applying Binary Conversion to Understand Subnetworking

What does all that binary mean for subnetworking? Well, as mentioned above, subnetting involves “borrowing” a bit from one of the host octets and adding it to the network address, which is done in the subnet mask.

So if you were going to subnet, or as the subnet mask is, you would first look at it in binary form:


and then change the first 0 of the host portion to a 1, resulting in:

11111111.10000000.00000000.00000000, or when expressed in base 10.


So what does this mean for configuring addresses on network devices and hosts? Well, instead of the usual subnet mask we’ll be using, but we also have to change addressing on the hosts. We will no longer be able to use 1-254 as host addresses, since half of those will belong on one subnet and half on another. We’ll talk about defining address ranges, as well as network and broadcast addresses and configuring network devices in the next article.

This post is part of the series: Complete Guide to Subnetworking

Learn all about what subnetworking is, why subnets are used, how to calculate subnet masks, and how to define subnet IP address ranges. We do more than provide you with the answer like a subnet calculator does - we teach you how to figure it out for yourself.

  1. Introduction to Subnetworking
  2. How to Subnetwork - Calculating Subnets
  3. Setting Up Subnetworks