Subnetting in Decimal (Fast Way)

(Rene Molenaar) #6

Thanks for letting me know, just fixed them!


great information, i have been in a class room setting for a bit and never had it explained this way


Hi Rene
When creating this blocks, do they have to be of equal size?

For example, you have an address of, and I am working to create a network/mask for the below requirements

I. 24 hosts
II. 111 hosts
III. 47 hosts
IV. 200 hosts

I came up with this , can you let me know if this is correct


If I did this way, is this correct?



(Andrew P) #9

Short answer: Everything you have is correct. For any given subnet mask, the block size is always the same.

People do subnetting many different ways. I haven’t heard of others doing it my way, but it works for me. I thought I might share with you how I can do subnetting very fast in my head–no calculators or even pencil and paper required.

I use the formula 2^X >= Y, which reads as 2 to the Xth power is greater than or equal to Y. Y is the number of hosts (or subnets) you are trying to figure out, and X is the variable you are trying to solve for. Let’s walk through one of your examples: 47 hosts. In this case we know that Y = 47. So now we have to figure out what power of 2 is as close to 47 as possible, but cannot be less. Two to the fifth power is 32, so that’s too small. How about 6? Two to the sixth power is 64–so that’s our answer: X = 6.

So what does X do for you? A lot! Once you solve for X, you can easily figure out two things:

  1. The network block size (the range of each subnet): This is simply 2^X, which in our case is 64. This means that your subnet ranges would be…
    0 - 63
    64 - 127
    128 - 191
    192 - 255
    Notice how on the left column above, I just increase the number by the block size? Easy!

  2. The subnet mask. You will have to know which octet you are trying to figure out (in this case it is the last octet). To figure out the mask, simply subtract 2^X from 256–so in this case it would be: 256 - (2^6) = 256 - 64 = 192. Now you know the subnet mask will be Easy!

(James D) #10

Both Rene and Andrew are amazing. I have been stuck on this for a couple of days and all I can say is THANK YOU!! The 2^x>=Y method and the 256 - block size just about cleared all my questions. Being a full-time worker, college student, and Dad is a lot on my plate and sometimes my brain is too tired to grasp things from the textbooks and lectures. I looked at this site today and viola, I am confident now.

Jim D.

(Jeremy C) #11

It would help if you included the subnet mask or prefix in your examples.

(Rene Molenaar) #12

Hi Jeremy,

In this example we do show the subnet mask for each “block”? :slight_smile:


(Gerson F) #13

Hi gyus,

I’ve done the exercises and I am most certain that they are correct, but could you leave us a link or an appendix with the solutions for confirmation purposes?


(Rene Molenaar) #14

Hi Gerson,

A subnet calculator might be even more useful. You can use this to verify anything you calculated.

For example:


(Rahul A) #15

Hi Andrew,

If i require just 2 hosts for P2P, i am having trouble using your formula. Since 2^X >= Y, where Y is 2, which makes X = 1. Now with X=1, make 2^1=2. The Subnet ranges would be:
and so on.
Which I believe is not correct, since for subnet, the host would be - Please clarify?

(Andrew P) #16

Use the formula (2^X) - 2 >= Y

(Maros Z) #17

Guys, I need help. Every time I try getting into different topics, be it NAT, Routing Policy, etc - I always get back to Subnetting. I finally realized there’s no way to progress without mastering this subject. I google everywhere, but I need your help and hopefully I’ll finally figure this out. Please, show me how would you answer this question;

Write a standard ACL that will cover the host range from through

Let’s not worry about the ACL part, but how would you go about writing an IP address with a subnet (wildcard) mask that would cover the need for 3 usable hosts?

You’d really help me out a lot.

Thank you in advance.

(Rene Molenaar) #18

Hi Maros,

Once you understand the fundamentals of subnetting, a quick way to solve a question like this is to visualize it and think in “blocks”:

And take a look at VLSM:

We want an access-list that matches four addresses, it starts with


The first thing we need to figure out is what these addresses are. Is it an exact subnet? In this case, it might be easy to see but if someone asks you to block “”, you’ll need to figure this out. A quick way to find out is to visualize the subnet as a “block” of 256 addresses:
If I cut it in half, I get two blocks:
You get two blocks of 128 so there are two subnets:

  • Subnet 1: -
  • Subnet 2: -

This quickly tells me that is a network address and since you specify four addresses, (a block of four), we know it’s an exact subnet that you try to match.

The range you want to match is not in the first block so we can forget about it. It is on the second block though:
So what’s the subnet mask for your subnet? A quick way to figure that out is to take the number 256 minus the block size:

256 - 4 = 252

We are working in the fourth octet so your subnet mask is

Now since we need a wildcard instead of a subnet mask, we have to convert it. In binary, the subnet mask looks like this:

11111111 11111111 11111111 11111100

A wildcard is an “inverted” subnet mask so we just flip the bits:

00000000 00000000 00000000 00000011

Which gives us a wildcard of

A quicker method is just to take the block size minus 1. Our subnet is a block of 4, so the wildcard becomes 3.

  • If you have a subnet that has 8 addresses, the wildcard is 7.
  • If you have a subnet that has 16 addresses, the wildcard is 15.
  • Etc

These “tricks” make it easier to quickly answer questions like this but make sure you understand the fundamentals, otherwise, you have no idea why we use these tricks. If not, you might want to go over the binary examples first:

Hope this helps!


1 Like
(Charles A) #19

Hi Rene,

Thanks for the great work. You are really making the topics easy to understand. One observation I want you to clarify is what you said about every bit borrowed doubles you network. It is true for the 1st and the 2nd bit but does not appear to be true for 3 bits and up. Can you confirm?

(Rene Molenaar) #20

Hello Charles,

Glad to hear you like it!

This logic applies to all bits. Let’s look at an example for subnet We need to look at the fourth octet where the host bits are. In binary it looks like this:


Right now we have 8 host bits and 1 subnet. Let’s borrow one host bit so we can create more subnets.


Now we have 2 subnets and 7 host bits. Let’s borrow one more:


Now we have 4 subnets and 6 host bits. Let’s borrow one more:


Now we have 8 subnets and 5 host bits. Let’s borrow one more:


Now we have 16 subnets and 5 host bits. You can continue like this.

Does this make sense?


(Jose S) #21

This is DOPE! Rene is a real beast!

1 Like
(Ajeet K) #22

Hi Rene,

I see that you have mentioned that is the first subnet and is the second subnet. I am confused as to why we didn’t we use as first subnet. Why is the ZERO subnet missing?? Please help.

(Lazaros Agapides) #23

Hello Ajeet

When doing subnetting, the first thing you define is the full range of addresses that you begin with. This is typically what the ISP will give you or what you have to work with within your network. From this range of addresses, you begin subnetting into smaller subnets.

In Rene’s example, the original network range that you are given is the subnet with a mask of This is provided by definition. You are then asked to subnet this range. In the lesson, the you are initially asked to use a subnet mask of So by definition again, the very first subnet will be because that is what you have been given and the second will be

Now if you were given the initial range of and asked for example to use a subnet mask of, then the first subnet would be, again because that’s what you are given to start with. The next would be, then etc…

I hope this has been helpful!


(Ajeet K) #24

Thank you for replying Lazaros.

In your second paragraph, you have mentioned that if we were to subnet to subnet mask /25, then the first subnet should be Why can’t we take the first subnet as - This can be the network address and the broadcast address can be
Also, I think in the first line of 3rd paragraph, it should be Please correct me if I am wrong.
Adding to it, I would also like to know if VLSM is enabled on all the routers by default or we have to enable it. Because, I guess the router will assume fixed size subnets if we don’t enable VLSM.


(Lazaros Agapides) #25

Hello Ajeet

If you are originally given a range of, and you begin dividing it into smaller subnets, the first subnet is always the lowest. So if we begin dividing this into /28 subnets for example, the first subnet will be The second will be, then and so on. Of course, each subnet has its network address, first, last and broadcast addresses as well…

Actually, I meant /23. gives us a range of addresses from to
If we subdivide this into smaller subnets using the, then we get the following subnets:

The example I used was to show that you start with an original range, and depending on the sizes of the subnets you want to make, you can divide that into smaller pieces.

I hope this has been helpful!