If you have ever heard networking geeks talk about subnetting or you are trying to learn it on your own, you may be wondering how anyone does all that subnetting magic binary math. Learning the math behind the subnetting is the key to a solid foundation. However, if you need to do subnetting really quickly (like for a certification exam), the following steps might help.

Most of the information for a subnetting question can be found by using the binary chart:

The top of the chart is binary through 128. The bottom of the chart are the subnet mask values. (If you will notice, you get these values by first bringing down the 128, and then adding the next binary value to it e.g. 128+64=192, 192+32=224, 224+16=240 and so on.) Now here is the trick to using this chart:

Say you have a subnet mask of 255.255.248.0 Well, from this mask you know that the subnetting will be done in the third octet.

-Fill in 1’s in the chart until you reach 248 on the third octet from left to right. (That would be 8 ones in the first row, 8 ones in the second row, and 5 ones in the third row.) In CIDR notation this would be /21.

Now you know that this is a /21 subnet mask.

-Just do the same process if you do not know the decimal subnet and you do know how many bits you have borrowed. So if you had to borrow 5 bits from a class B address, then you would end up with a /21 (just fill in the 1’s).

Now comes the cool part. Finding your network increment. (In other words, knowing on which address the network begins and ends.)

-Having just filled in the 1’s on your chart you should see that you have stopped filling in 1’s at the 248 column in the third row of the binary chart.

-Now follow that column up until you get to the top row where the 8 is in the binary chart. Guess what? 8 is your network increment.

So you know that the Network ID’s are going to be multiples of 8. (*.*.8.*, *.*.16.*, *.*.24.* and so on.) This method works every time. It is a handy shortcut that has helped me on many networking tests. I hope that it helps you as well. Good luck with your certifications or other subnetting endeavors.

Thank you for reading! The information outlined in this post will work for any type of subnet (class A,B,C, or classless). Just follow the same method. For example, on a class B address (i.e. if you want to subnet it to 255.248.0.0), you will know that the subnetting will take place in the second octet, so you will only have two rows of 1’s to deal with. I hope this helps.

June 20th, 2009 at 6:27 am

Steve said:

“Fill in 1’s in the chart until you reach 248 on the third octet from left to right. (That would be 8 ones in the first row, 8 ones in the second row, and 5 ones in the third row.)”

– I don’t understand this. Where are you putting 1s and adding them up to reach 248?? I’ve stared at your example for 10 minutes but can’t figure it out.

July 16th, 2009 at 11:27 pm

hstagner said:

Hello Steve,

Thank you for reading. I am not adding anything. You simply fill in ones under the binary chart until you reach 248 on the third row (representing the third octet). Does this help?

July 17th, 2009 at 8:53 am

Panchocolate said:

How come everybody talks about the third row when there are only two.

July 19th, 2009 at 12:05 pm

hstagner said:

Hello Panchocolate,

Thank you for reading. The rows start after the two rows that make up the chart. The rows where you fill in the 1’s are blank until you actually fill in the 1’s. So, a row of 1’s would be row 1. Another row of 1’s would be row 2. Finally, the third row of 1’s would be row 3. I hope this helps.

July 19th, 2009 at 2:16 pm

Matt said:

This chart is great for people who understand subnetting just enough to know it’s hard but not enough to quickly do the math. This chart makes it so that it is pretty quick.

The only problem for you is when people reading this have no idea about subnetting. This post isn’t for beginners.

~Matt

August 9th, 2009 at 11:14 am

mark said:

I was with you until you explained 8 as the network increment. Why 8?

September 17th, 2009 at 7:53 pm

hstagner said:

Hello Mark,

Thanks for reading. 8 is the network increment because that is where you stopped filling in 1’s in the binary chart. Wherever you stop, follow the row up to the top. That is your network increment.

thanks for sharing this very informative post.this is very helpful for beginner’s.keep it up.

October 12th, 2009 at 4:14 pm

mike said:

“Fill in 1’s in the chart until you reach 248 on the third octet from left to right. (That would be 8 ones in the first row, 8 ones in the second row, and 5 ones in the third row.) In CIDR notation this would be /21.”

This is very confusing and doesn’t make any sense if you read it how it is worded. 8 ones in the first “row”. you mean octet, not row. why are you saying row instead of octet? the 4 octets that make up an ip address are all in the same row.

October 16th, 2009 at 5:50 pm

hstagner said:

Ok. 1 octet = 1 row. Start at the left and fill in ones to the right. When you get to the 1 up top or 255 on the bottom, time to move to the row below.

11111111
11111111
11111

There are three “rows”. One row of 8, one row of 8, and one row of 5. They represent the three octets.

Stop splitting hairs.

October 16th, 2009 at 8:20 pm

Brian said:

I read it and i kind of got lost on some parts… but my question is, where do you begin, if you want to have 5 subnets, using the 4 octet.

EG – There is 5 rooms, each room needs to have a subnet. Where do I begin?

Is there a formula i can use, where i can put in 5 and the result will tell me how many bits im borrowing from the 4th octet?

Sorry if it sounds confusing…
Thanks

October 22nd, 2009 at 3:58 am

hstagner said:

Hello Brian,

Thank you for reading! Can you give me an example of the problem you need to work out?

What is the Network IP address that you are trying to subnet. Thank you.

October 22nd, 2009 at 8:10 am

Brian said:

This is the exact question ‘Create an IP addressing scheme that has 5 subnets with room for expansion’ and the IP is 199.120.16.0 / 24

Where do I begin? how do I figure out how many bits needs to be borrowed to equal 5 subnets, without doing so much working out?

Thanks

October 22nd, 2009 at 8:15 am

hstagner said:

Hello Brian,

It’s easier to explain when you have an example.

The formula for finding out the number of bits is:

(2^n) – 2 = x

Where “n” is the number of bits you need to borrow and “x” is the number of subnets that will be produced.

You need 5 subnets:

(2^n) – 2 = x

Try 2 first:
(2^2) = 4 and 4-2 is 2 (this is too low)

Try 3 next:
(2^3) = 8 and 8-2 is 6 (this is correct since it will give you 6 subnets)

You have borrowed 3 bits.
So for your example, you would end up with:

199.120.16.0 /21 (since 24-3 = 21)

Just follow the post at this point to determine network increment, etc.

October 22nd, 2009 at 9:28 am

oheneba said:

please i have read your page and i have loved your subnetting.i am now about to try it.if it works i will be grateful or any difficulties i will contact you for help.thank you.

October 23rd, 2009 at 5:31 pm

soontobeCCNA said:

In the last paragraph where you explain the network increments of 8, how would you find the beginning and end hosts with that? Do you mean it starts with 0 and goes to 7, then starts with 8 and goes to 15, etc? What if the exam question deals with some really high number like 172.50.201.99/21 or something? How will you know where the increments begin and end without doing some serious long division in your head?

November 2nd, 2009 at 12:55 pm

Muzaffar said:

tanx i have been read the subnetting it was explined in easyist way and i hope i could learn more thing from this side

You can generate examples and practice. Do this for an hour, and you’ll feel like an expert.

January 17th, 2010 at 10:19 pm

hassan hassan said:

for novice networking engineer, the post is completely valuable for subnetting. really, i’m really happy for this intelligent tools.

January 18th, 2010 at 9:31 am

Pepilepew said:

Please correct me if I am wrong.

This IP address is a class C with a mast of 28 which means 4 bits of network and 4 bits of subnets.

128 64 32 16 8 4 2 1

1 1 1 1 0 0 0 0

Given the ip address 209.46.195.123/28

why would the network be 209.46.195.112

why would the 1st host be 209.46.195.113

why would the last host be 209.46.195.126

why would the b-cast be 209.46.195.127

Can you please explain. Thank you.

January 23rd, 2010 at 7:23 pm

shinji1212 said:

how would go about doing this: use the address space 192.168.1.0/24

Vlan 15: needs space for 100 hosts?

April 11th, 2010 at 9:58 am

mike said:

need to find the network address,subnet mask, first available host, broadcast address, and last available host for the IP address 216.205.247.24/27 can anyone help me please.

April 15th, 2010 at 6:49 am

Brian said:

@ mike: in your example 216.205.247.24/27 the /27 part represents a 27 bit subnet mask (i.e. 255.255.255.224) which would borrow 8 host bits from a class C IP address and give you 32 hosts per subnet.

So the subnet addresses would be 216.205.247.0, .32, .64, .96, .128, .160, .192, and .224. The IP address you listed (216.205.247.24) would fall in the first subnet (216.205.247.0) which would have a range of 216.205.247.1 – 216.205.247.30 (216.205.247.31 would be the broadcast address and cannot be assigned to a host)

Hope that helps!

June 15th, 2010 at 2:27 pm

Andrea said:

Assign a 60 host network using the ip block 192.168.1.0/24. Allow 0 and 1 subnets? Please can you help me out on how to assign this from the 1st host to the 60th host. Thanks.

July 5th, 2010 at 7:12 am

Andrea said:

Assign a 60 host network using the ip block 192.168.1.0/24. Allow 0 and 1 subnets? Please can you help me out on how to assign this from the 1st host to the 60th host. Thanks..