How to Calculate the Number of Hosts Per Subnet

by Stephanie Ellen
Subnets are part of an IP network.

Subnets are part of an IP network.

In computer networking, subnets are used for routing purposes. Internet protocol (IP) networks are sometimes divided into logical subnets, which are parts of the network that can be distinctly addressed. When figuring out the number of hosts per subnet, you are limited by the number of bits that form the host ID according to the following mathematical equation: number of hosts per subnet = (2^H) - 2, where H is the number of bits in the host ID.


Determine the number of bits that form the host ID. For example, you might have a host ID of 001 (3 bits).


Figure out what the number in Step 1 is to the power of 2. Powers of 2 are 2 raised to the nth power. For example, 2^2 = 4 and 2^5 = 32. In the above example, there are 3 bits in the host ID so 2 is raised to the 3rd power: 2^3 = 8.


Subtract 2 from the answer you calculated in Step 2. In the given example, the number of hosts per subnet is 8 - 2 = 6.

About the Author

Stephanie Ellen teaches mathematics and statistics at the university and college level. She coauthored a statistics textbook published by Houghton-Mifflin. She has been writing professionally since 2008. Ellen holds a Bachelor of Science in health science from State University New York, a master's degree in math education from Jacksonville University and a Master of Arts in creative writing from National University.

Photo Credits

  • photo_camera internet image by Soja Andrzej from