Skip to main content
IP Range CalculatorPRO
IPv4 Subnetting & RangeInstant Client-Side Tool

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.

Quick presets:

Calculated Boundaries & ParametersReady

Network Address192.168.1.0
Broadcast Address192.168.1.255
First Usable Host192.168.1.1
Last Usable Host192.168.1.254
Subnet Mask255.255.255.0
Wildcard Mask0.0.0.255
Total Addresses256
Usable Host Range254

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.

  1. Enter a prefix or mask

    Type /27 or 255.255.255.224.

  2. Count the network bits

    The calculator counts the 1 bits in the mask. 255.255.255.224 has 27.

  3. Subtract from 32

    32 − 27 = 5 host bits.

  4. 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 − p

The prefix length p counts the network bits.

Addresses from host bits

Total = 2^h

5 host bits give 32 addresses.

Usable hosts from host bits

Usable = 2^h − 2

Valid 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.

PrefixNetwork BitsHost BitsLast Octet (N = net, H = host)Usable Hosts
/202012HHHHHHHH4,094
/212111HHHHHHHH2,046
/222210HHHHHHHH1,022
/23239HHHHHHHH510
/24248HHHHHHHH254
/25257NHHHHHHH126
/26266NNHHHHHH62
/27275NNNHHHHH30
/28284NNNNHHHH14
/29293NNNNNHHH6
/30302NNNNNNHH2
/31311NNNNNNNH2
/32320NNNNNNNN1

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.