How to Calculate Subnet Masks and IP Ranges from CIDR Notation
Master Classless Inter-Domain Routing (CIDR) subnet calculations. Learn how to determine usable host IP addresses, network IDs, and broadcast addresses.

How to Calculate Subnet Masks and IP Ranges from CIDR Notation
In cloud architecture (AWS VPCs, Azure Virtual Networks, Google Cloud) and enterprise networking, CIDR notation (Classless Inter-Domain Routing) is the universal standard for allocating IP address blocks.
Understanding how a CIDR prefix (such as /24 or /16) translates into usable host IP addresses, subnet masks, and network boundaries is a core competency for systems engineers and web developers.
This guide breaks down IPv4 binary math, explains how to determine usable IP addresses, and links to the CalculatorAll Subnet & CIDR Calculator.
What Does the Slash (/) in CIDR Represent?
An IPv4 address consists of 32 binary bits divided into four 8-bit octets (e.g., 192.168.1.0).
The slash notation (/prefix) specifies how many leading bits are allocated to the Network ID, leaving the remaining bits for Host addresses:
Host Bits (h) = 32 - CIDR Prefix
Total IP Addresses = 2^h = 2^(32 - Prefix)
Usable Host IP Addresses = 2^h - 2
(Note: We subtract 2 because the very first IP is the Network Identifier and the very last IP is the Broadcast Address).

Step-by-Step Calculation: 192.168.1.0/24
Suppose you are configuring a subnet with the CIDR block 192.168.1.0/24:
- Calculate Host Bits:
32 - 24 = 8 bits for hosts. - Calculate Total IPs:
2⁸ = 256 total IP addresses. - Calculate Usable IPs:
256 - 2 = 254 usable host addresses. - Determine the Subnet Mask: The first 24 bits are set to
1in binary (11111111.11111111.11111111.00000000), which in decimal is255.255.255.0. - Determine the Address Range:
- Network ID:
192.168.1.0 - First Usable Host:
192.168.1.1 - Last Usable Host:
192.168.1.254 - Broadcast Address:
192.168.1.255
- Network ID:

CIDR IPv4 Subnet Cheat Sheet
| CIDR Prefix | Subnet Mask | Total IPs | Usable Hosts | Common Use Case |
|---|---|---|---|---|
| /30 | 255.255.255.252 | 4 | 2 | Point-to-point router links |
| /29 | 255.255.255.248 | 8 | 6 | Small server DMZ |
| /28 | 255.255.255.240 | 16 | 14 | Kubernetes node pods |
| /27 | 255.255.255.224 | 32 | 30 | Database subnet cluster |
| /24 | 255.255.255.0 | 256 | 254 | Standard office LAN / Web tier |
| /20 | 255.255.240.0 | 4,096 | 4,094 | Mid-sized cloud VPC |
| /16 | 255.255.0.0 | 65,536 | 65,534 | Production enterprise VPC |
Try the numbers with our calculator
Use your own assumptions instead of relying on a generic example.
Calculate Subnet & CIDR Ranges

