Dec 5 2007

How to subnet an IP address the easy way

If you're new here, you may want to start with my most popular posts. Then, subscribe to my RSS feed to stay updated. Thanks for visiting! Tip

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:

128 | 64   | 32   | 16   | 8     | 4     | 2     | 1     |
128 | 192 | 224 | 240 | 248 | 252 | 254 | 255 |

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 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.

Happy Subnetting!

Technorati Tags: , , ,

No related posts.

Related posts brought to you by Yet Another Related Posts Plugin.

49 Comments on this post


  1. » Het Subnet sprookje wrote:

    [...] Subnet informatie [...]

    June 10th, 2009 at 4:12 am
  2. Icoo Blog » Het Subnet sprookje wrote:

    [...] Subnet informatie [...]

    August 25th, 2009 at 8:38 am
  1. Sayed Taleb Jan said:

    I want to subnet A,B,C classes to classless addresses please send my step by step information about it.

    June 20th, 2009 at 5:18 am
  2. hstagner said:


    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, 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
  3. 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
  4. 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
  5. Panchocolate said:

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

    July 19th, 2009 at 12:05 pm
  6. 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
  7. 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.


    August 9th, 2009 at 11:14 am
  8. mark said:

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

    September 17th, 2009 at 7:53 pm
  9. 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.

    I hope this helps.


    Harley Stagner

    September 18th, 2009 at 9:56 am
  10. dog kennel said:

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

    October 12th, 2009 at 4:14 pm
  11. 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
  12. 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.


    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
  13. 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…

    October 22nd, 2009 at 3:58 am
  14. 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
  15. Brian said:

    This is the exact question ‘Create an IP addressing scheme that has 5 subnets with room for expansion’ and the IP is / 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?


    October 22nd, 2009 at 8:15 am
  16. 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: /21 (since 24-3 = 21)

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

    October 22nd, 2009 at 9:28 am
  17. 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
  18. 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 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
  19. 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

    December 15th, 2009 at 11:20 am
  20. saleem said:

    the chart is very best way to remember the mask thanks

    December 31st, 2009 at 2:56 am
  21. harish said:

    I want to subnet A,B,C classes to classless addresses please send my step by step information about it.

    January 8th, 2010 at 11:37 pm
  22. Morgan said:

    This post is excellent. I’m now using these instructions to teach a class. If you want some practice with instant feedback, try reading this post, then heading here:

    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
  23. 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
  24. 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

    why would the network be

    why would the 1st host be

    why would the last host be

    why would the b-cast be

    Can you please explain. Thank you.

    January 23rd, 2010 at 7:23 pm
  25. shinji1212 said:

    how would go about doing this: use the address space

    Vlan 15: needs space for 100 hosts?

    April 11th, 2010 at 9:58 am
  26. mike said:

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

    April 15th, 2010 at 6:49 am
  27. Brian said:

    @ mike: in your example the /27 part represents a 27 bit subnet mask (i.e. 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, .32, .64, .96, .128, .160, .192, and .224. The IP address you listed ( would fall in the first subnet ( which would have a range of – ( would be the broadcast address and cannot be assigned to a host)

    Hope that helps!

    June 15th, 2010 at 2:27 pm
  28. Andrea said:

    Assign a 60 host network using the ip block 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
  29. Andrea said:

    Assign a 60 host network using the ip block 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:14 am
  30. cross trainer said:

    How do i figure out what subnet mask to use for a given IP Address? (I run out of detail characters)?

    July 29th, 2010 at 2:04 pm
  31. Gunsaru Daniel said:


    Thanks for the lesson it helped me alot,previuos i had lots of problems.

    September 13th, 2010 at 6:43 pm
  32. Anonymous said:
  33. NetworkChic said:

    This was the final explanation that turned on all the lights for me! Thank you Thank you Thank you!!

    November 30th, 2010 at 10:22 am
  34. happyman said:

    i am trying to sort out an exercise about subnetting, it gave me an ip and it gave me host of 91 and want:

    what is the default subnet mask( dotted decimal)?

    how many bits did you borrow for the subnets?

    what is the new subnet mask( dotted decimal)?

    how many subnets have been created?

    what is the new subnet mask(ip prefix)?

    February 13th, 2011 at 1:06 pm
  35. aaron cran said:


    February 28th, 2011 at 10:42 am
  36. Naz said:

    How would you answer this question “Which subnet does host belong to”

    March 9th, 2011 at 8:47 pm
  37. Aijaz H Chougle said:

    I want to subnet A,B,C classes to classless & class full addresses please send my step by step information about it.

    March 15th, 2011 at 4:57 am
  38. tom said:


    April 6th, 2011 at 2:19 pm
  39. mohammad aslam said:

    ip addresses are very important for use of networking in small business like in banks and in other department

    May 9th, 2011 at 2:06 am
  40. suraj said:

    can any 1 plz solve this in detail…

    May 15th, 2011 at 12:25 am
  41. ndobe said:

    it’s very interesting and i have learn alot

    May 28th, 2011 at 9:51 pm
  42. fredwalkings said:

    i dont understand, please give more detailed simply way of subnetting

    May 29th, 2011 at 4:33 pm
  43. kaustubh said:

    your method is very good i see this

    August 22nd, 2011 at 5:31 am
  44. srikanth said:


    Great Idea, Thanks for sharing the information,

    September 27th, 2011 at 6:51 am
  45. Sikhitha Ndiafhi Byron said:

    Use address to create 255 subnets. usethe 5th subnet for your network.write down the subnet address that you will use :1. subnet address
    2. subnet mask

    so how can i deal with a question like this?

    October 13th, 2011 at 12:15 pm
  46. James said:

    If my network address is and I have to borrow 5 bits wont this leave me without any hosts.


    11100111.01100001. 10000000.00000000=32 bits so i borrow the last 5 bits on the very right for subnets. What about the hosts?

    My subnet mask will be 11111111.11111111.11111111.11111111.

    I dont get it! any help?

    November 17th, 2011 at 9:01 am

    I hv a problem with all classes of subnetting. Pls send me

    November 18th, 2011 at 1:28 am


Subscribe Form

Subscribe to Blog


Recent Readers

                  Computers Blogs - Blog Top Sites