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

Network Bits Calculator

Identify the network prefix length.

Network 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 Network Bits Calculator Works?

This tool works by counting the consecutive 1 bits in a subnet mask, from left to right. That count is the prefix length.

  1. Enter a subnet mask

    Type a dotted mask such as 255.255.240.0.

  2. Convert each octet to binary

    255 = 11111111, 240 = 11110000, and 0 = 00000000.

  3. Count the 1 bits

    8 + 8 + 4 + 0 = 20 network bits.

  4. Return the prefix

    The result is /20, with 12 bits left for hosts.

Network Bits Calculator Formula

The formula is Network Bits = the sum of the 1 bits in all 4 mask octets.

Network bits

n = popcount(o1) + popcount(o2) + popcount(o3) + popcount(o4)

popcount counts the 1 bits in one octet.

Octet values

0, 128, 192, 224, 240, 248, 252, 254, 255

A valid mask octet takes 1 of these 9 values, holding 0 to 8 network bits.

Network bits from host count

n = 32 − log2(Total)

A block of 4,096 addresses has 32 − 12 = 20 network bits.

Worked example: 255.255.240.0

255 → 11111111 → 8 bits
255 → 11111111 → 8 bits
240 → 11110000 → 4 bits
0   → 00000000 → 0 bits
Network bits = 20 → /20

Network Bits Calculator Conversion Table

The table maps 12 dotted subnet masks to their binary form and network bit count.

Subnet MaskBinary MaskNetwork BitsNetwork Bytes
255.0.0.011111111.00000000.00000000.0000000081
255.240.0.011111111.11110000.00000000.00000000121.5
255.255.0.011111111.11111111.00000000.00000000162
255.255.224.011111111.11111111.11100000.00000000192.375
255.255.240.011111111.11111111.11110000.00000000202.5
255.255.248.011111111.11111111.11111000.00000000212.625
255.255.252.011111111.11111111.11111100.00000000222.75
255.255.255.011111111.11111111.11111111.00000000243
255.255.255.19211111111.11111111.11111111.11000000263.25
255.255.255.24011111111.11111111.11111111.11110000283.5
255.255.255.25211111111.11111111.11111111.11111100303.75
255.255.255.25511111111.11111111.11111111.11111111324

What is Network Bits Calculator?

The Network Bits Calculator is a tool that returns how many bits of a subnet mask identify the network. The network bit count equals the CIDR prefix length.

Every IPv4 subnet mask starts with a run of 1 bits and ends with a run of 0 bits. The 1 bits mark the network part of the address. The Network Bits Calculator counts that run and reports it as a number from 0 to 32.

Network bits and prefix length describe the same value. 255.255.255.0 has 24 network bits, which is written as /24 in CIDR notation.

What are the uses of Network Bits Calculator?

There are 4 main uses of the Network Bits Calculator, including mask translation, configuration review, and exam practice.

  • Translating legacy configurations

    Older devices show dotted masks, and newer platforms expect a prefix length. The bit count bridges both formats.

  • Reviewing configuration files

    Auditors scan configurations for masks such as 255.255.248.0 and confirm that each one equals /21.

  • Practicing mask conversion

    Students convert dotted masks to prefix lengths without a calculator and check the answer with the tool.

  • Matching route prefixes

    Routing tables compare prefix lengths. The bit count shows which route is more specific.