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.
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 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.
Enter a subnet mask
Type a dotted mask such as
255.255.240.0.Convert each octet to binary
255 = 11111111, 240 = 11110000, and 0 = 00000000.
Count the 1 bits
8 + 8 + 4 + 0 = 20 network bits.
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, 255A 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 Mask | Binary Mask | Network Bits | Network Bytes |
|---|---|---|---|
| 255.0.0.0 | 11111111.00000000.00000000.00000000 | 8 | 1 |
| 255.240.0.0 | 11111111.11110000.00000000.00000000 | 12 | 1.5 |
| 255.255.0.0 | 11111111.11111111.00000000.00000000 | 16 | 2 |
| 255.255.224.0 | 11111111.11111111.11100000.00000000 | 19 | 2.375 |
| 255.255.240.0 | 11111111.11111111.11110000.00000000 | 20 | 2.5 |
| 255.255.248.0 | 11111111.11111111.11111000.00000000 | 21 | 2.625 |
| 255.255.252.0 | 11111111.11111111.11111100.00000000 | 22 | 2.75 |
| 255.255.255.0 | 11111111.11111111.11111111.00000000 | 24 | 3 |
| 255.255.255.192 | 11111111.11111111.11111111.11000000 | 26 | 3.25 |
| 255.255.255.240 | 11111111.11111111.11111111.11110000 | 28 | 3.5 |
| 255.255.255.252 | 11111111.11111111.11111111.11111100 | 30 | 3.75 |
| 255.255.255.255 | 11111111.11111111.11111111.11111111 | 32 | 4 |
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.0and 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.