In this blog post I will take you through working out how many IPv4 IP addresses there are in a subnet using the built in Windows calculator.
Let’s take an example of a /24 mask, and I want to know how many IP addresses I can use,
192.168.1.0/24 and a mask of 255.255.255.0
If you haven not already read my post on CIDR notation simplified, I would recommend you have a read.
11111111 | 11111111 | 11111111 | 00000000 |
255 | 255 | 255 | 0 |
Add up the 1’s, that’s a total of 24 bits, that’s where the /24 comes from. See my post CIDR notation simplified if you wish to dive deeper.
How do I calculate how many available IP addresses I can assign from the above. We’ll use the Windows calculator,
Click on your start menu and search for calculator,
Switch from standard to scientific
In the example above we had a subnet mask of /24. The sum to calculate the number of IP addresses available would be,
A total of 32 if we total all the bits together, we minus the bits which are turned on, 24, so that’s 32 – 24 leaving us with 8 bits (The last box to the right below).
11111111 | 11111111 | 11111111 | 00000000 |
255 | 255 | 255 | 0 |
The sum is below, but let’s input this into the calculator.
- 32 minus 24 = 8
- we now calculate 2 to the power of 8
- To do this, clear the calculator and type 2
- Next, click the Xy button as shown in the screenshot below
5. Type 8 and click the = button
That gives us 256 IP addresses in a /24 subnet mask. We take away two as we don’t use .0 (Network address) and 255 (Broadcast address) = 254 IP’s that we can use
Try the sum with another example,
What do you get if you calculate /16, /27 and /32 using the method above. What numbers appear on your calculator.
Let me know in the comments section below
/16 = ? post the answer below
/27 = ? post the answer below
/23 = ? post the answer below
That’s it. I hope you found this post useful.
/16 = 65,536 (65,534 usable)
/27 = 32 (30 usable)
/23 = 512 (510 usable)
I had no idea it was this easy, thanks for sharing Imran
I agree with Graeme’s answer 🙂
omg.. why did I struggle with this during my certs.. LOL, so simple. 🙂
So simple!!
Thankyou
Thank you so much!
That was easy! Cheers Imran!
Cheers Imran!