How many IP Addresses in a Subnet?

This question comes up a lot in Networking.

It’s surprislingly easy to workout what a /26 subnet is, with a little theory.

Currently an IP4 address is 32bits.

That’s 4294967296 IP addresses, which isn’t enough for the whole world without Network Address Translation on the end of your routers to local networks. Which is why IPV6 has been released and gradually being adopted across the world.

To make it easier, they split up the address into 4x 8-bit octets e.g.

Subnets have a beginning and an ending, and the beginning number is always even and the ending number is always odd. The beginning number is the “Network ID” and the ending number is the “Broadcast ID.” You’re not allowed to use these numbers because they both have special meaning with special purposes. The Network ID is the official designation for a particular subnet, and the ending number is the broadcast address that every device on a subnet listens to. Anytime you want to refer to a subnet, you point to its Network ID and its subnet mask, which defines its size. Starting to get the idea? If not email me 🙂

Some subnet calculations making it easy.

So the question is, how many IP’s per subnet?

Example /26

A /26 subnet is essentially a portion of 32 bits. So do 32 minus 26, which equals 6.

Now, if you start at 2, and count 6x times, you get 2, 4, 8, 16, 32, 64

Easy right, that’s 64 IP addresses in a /26 subnet.

Example / 27

32 – 27 = 5

2, 4, 8, 16, 32

So a /27 is 32 IP Addresses (minus 2, the start and end points, broadcast etc).

Example /20

32 – 20 = 12

2, 4, 8,

16, 32, 64

128, 256, 512

1024, 2048, 4096

So a /20 is 4096 IP Addresses Minus the start and end which is 2, so 4094.




I found this to be easy once I fully understood what I was doing. We know that an subnet has 32 bits, that never changes, there is a relationship between hosts and networks.. so when someone says how many IP’s in a /25 for instance just do this. 32 – 25 = 7 bits. now count (use your fingers if you choose) starting with 2 doubling the last number always. In this example we would count like this, 2, 4, 8, 16, 32, 64, 128. This is 7 bits. There are 128 IP’s in a /25 and 126 useable. Conversely there are 2 networks. If you try another say /18 we do this 32-18=14 bits. Get out your fingers and toes lets start . 2, 4, 8, 16,32,64,128,256,512,1024, 2048, 4096, 8192, 16384. There are 16384 ip’s. the subnet in this example is each subnet has 32bits in 4 octets so 255= 8 bits, so an 18 bit subnet is 255 (8 bits). 255(8bits). 192 (2bits). 0. = subnet is that equals 4 networks with 16384-2 hosts per network. See simple.