Host Bits Calculator
Calculate bits available within a prefix.
Host Bits Calculator: inputs and results
Enter an IP address, CIDR prefix, or range. Then check its first and last address below.
Calculated Boundaries & ParametersReady
Key Capabilities
- •100% Client-Side: Zero telemetry or server latency.
- •RFC Compliant: Exact 32-bit and 128-bit integer precision.
- •Quick Copy: Instant access to CIDR, mask, and range bounds.
- •Cross-Platform: Works on desktop, tablet, and mobile browsers.
Related IPv4 Subnetting & RangeAll Tools
IPv4 Range Calculator
Find address boundaries from a prefix.
IPv4 Subnet Calculator
Calculate subnet details from address and mask.
Network Address Calculator
Find the subnet’s network address.
IPv4 Broadcast Address Calculator
Find broadcast addresses where applicable.
First and Last Address Calculator
Identify a range’s endpoints.
Usable IPv4 Host Range Calculator
Apply the selected subnet-use rules.
How Host Bits Calculator Works?
This tool works by subtracting the prefix length from 32 to find the number of bits left for host addressing. Each host bit doubles the number of addresses in the subnet.
Enter a prefix or mask
Type
/27or255.255.255.224.Count the network bits
The calculator counts the 1 bits in the mask.
255.255.255.224has 27.Subtract from 32
32 − 27 = 5 host bits.
Show the host bit pattern
The calculator marks the 5 rightmost bits as host bits and returns 2^5 = 32 addresses and 30 usable hosts.
Host Bits Calculator Formula
The formula is Host Bits = 32 − Prefix Length.
Host bits
h = 32 − pThe prefix length p counts the network bits.
Addresses from host bits
Total = 2^h5 host bits give 32 addresses.
Usable hosts from host bits
Usable = 2^h − 2Valid when h ≥ 2.
Host bits needed for N hosts
h = ceil(log2(N + 2))Finds the smallest host field that fits N devices.
Worked example: /27
Mask = 11111111.11111111.11111111.11100000 h = 32 − 27 = 5 host bits Total = 2^5 = 32 addresses Usable = 32 − 2 = 30 hosts
Host Bits Calculator Conversion Table
The table maps 13 prefix lengths to their network bits, host bits, last-octet bit pattern, and usable hosts.
| Prefix | Network Bits | Host Bits | Last Octet (N = net, H = host) | Usable Hosts |
|---|---|---|---|---|
| /20 | 20 | 12 | HHHHHHHH | 4,094 |
| /21 | 21 | 11 | HHHHHHHH | 2,046 |
| /22 | 22 | 10 | HHHHHHHH | 1,022 |
| /23 | 23 | 9 | HHHHHHHH | 510 |
| /24 | 24 | 8 | HHHHHHHH | 254 |
| /25 | 25 | 7 | NHHHHHHH | 126 |
| /26 | 26 | 6 | NNHHHHHH | 62 |
| /27 | 27 | 5 | NNNHHHHH | 30 |
| /28 | 28 | 4 | NNNNHHHH | 14 |
| /29 | 29 | 3 | NNNNNHHH | 6 |
| /30 | 30 | 2 | NNNNNNHH | 2 |
| /31 | 31 | 1 | NNNNNNNH | 2 |
| /32 | 32 | 0 | NNNNNNNN | 1 |
What is Host Bits Calculator?
The Host Bits Calculator is a tool that returns the number of bits in an IPv4 address reserved for identifying hosts inside a subnet. The host field sits to the right of the network field in the 32-bit address.
Host bits set the size of a subnet. A subnet with h host bits holds 2^h addresses. A /24 has 8 host bits (256 addresses), and a /16 has 16 host bits (65,536 addresses).
Subnetting moves bits from the host field into the network field. The Host Bits Calculator shows how many host bits remain after each move, which makes subnet math visible bit by bit.
What are the uses of Host Bits Calculator?
There are 4 main uses of the Host Bits Calculator, including subnet design, binary training, and mask selection.
Designing subnet sizes
Engineers pick the number of host bits first, then derive the mask. 6 host bits give 62 hosts on a /26.
Learning binary subnetting
Students count host bits to solve "borrow bits" questions in CCNA and Network+ exams.
Choosing masks for device counts
The
ceil(log2(N + 2))formula picks the smallest host field for N devices.Explaining subnet trade-offs
Each bit moved from host to network doubles the subnet count and halves the hosts per subnet.