How to Calculate CIDR Subnets and Extract IP Ranges Online

To calculate IPv4 CIDR subnets and extract usable IP address lists, perform bitwise AND operations between the IP address and its subnet mask to isolate the network address, derive the broadcast boundary from host bits, and enumerate all intermediate assignable IPs using an online CIDR and subnet extractor entirely within local browser memory.
Enterprise networking, cloud infrastructure design, and cybersecurity auditing rely on Classless Inter-Domain Routing (CIDR) to allocate IP address blocks efficiently. Whether configuring an AWS Virtual Private Cloud (VPC), partitioning Azure Virtual Networks (VNets), or auditing firewall access control lists (ACLs), network engineers routinely translate CIDR slash notation (such as 192.168.1.0/24 or 10.0.0.0/16) into precise network boundaries, usable host ranges, and individual IP lists.
Manual binary calculations across variable octet boundaries are error-prone. Conversely, uploading proprietary corporate IP schemes to public cloud tools introduces severe security risks. Understanding the mathematical fundamentals of subnetting alongside client-side browser tools enables engineers to compute, validate, and extract network ranges instantly and securely.
Key Definitions: Classless Inter-Domain Routing (CIDR / RFC 4632), Subnet Mask, Wildcard Mask, Network Address, Broadcast Address, and Usable Host Range
Mastering IP subnetting requires understanding the fundamental networking terms standardized by the Internet Engineering Task Force (IETF):
- Classless Inter-Domain Routing (CIDR / RFC 4632): An IP addressing scheme replacing legacy class-based allocations. CIDR uses variable-length subnet masking (VLSM) and prefix notation (e.g.
/24) to allocate IP blocks based on exact capacity requirements rather than fixed boundaries. - Subnet Mask: A 32-bit binary sequence separating an IP address into network and host portions. Consecutive binary
1s denote network bits, while consecutive0s represent host bits. In dotted-decimal notation, 24 network bits are written as255.255.255.0. - Wildcard Mask: The bitwise inverse of a subnet mask, determined by subtracting each octet from 255 (e.g.
0.0.0.255for a/24prefix). Widely used in Cisco IOS Access Control Lists (ACLs) and OSPF routing filters. - Network Address: The lowest numerical address within a subnet where all host bits are binary
0. It identifies the network segment to routers and cannot be assigned to an individual host interface. - Broadcast Address: The highest numerical address in a standard subnet where all host bits are binary
1(e.g.192.168.1.255for192.168.1.0/24). Packets sent to this address target all hosts on the broadcast domain. - Usable Host Range: The assignable IP addresses between the network and broadcast addresses (from
Network + 1toBroadcast - 1).
Classful Networking vs CIDR: How Prefix Lengths (/24, /16, /8) Eliminated IP Address Space Exhaustion
Prior to CIDR introduction in 1993, the global IPv4 address space was divided into rigid, predefined classes defined in RFC 791:
- Class A (/8): Allocated 8 network bits and 24 host bits (16,777,214 usable addresses per network). Organisations assigned Class A blocks rarely utilised millions of IPs, causing massive address waste.
- Class B (/16): Allocated 16 network bits and 16 host bits (65,534 assignable host addresses). Demand for Class B blocks depleted available pools during early internet expansion.
- Class C (/24): Allocated 24 network bits and 8 host bits (254 usable addresses). Organisations needing 500–1,000 addresses required multiple Class C blocks, causing global routing tables to inflate exponentially.
- Class D (/4) & Class E (/4): Reserved exclusively for multicast traffic (
224.0.0.0/4) and experimental research (240.0.0.0/4).
IETF RFC 1519 and RFC 4632 established CIDR, eliminating fixed class boundaries. CIDR permits network administrators to subdivide or aggregate (supernet) IP blocks along arbitrary bit boundaries. Appending a slash prefix (such as /22 for 1,022 usable hosts or /27 for 30 usable hosts) matches exact operational needs, conserving IPv4 addresses and preventing global BGP routing table collapse.
Step-by-Step: How to Calculate CIDR Subnets and Extract IP Ranges in Your Browser
Calculate subnet boundaries and extract assignable IP address lists in five steps using browser-based tooling:
-
Input Your Target CIDR Block:
Enter your base IP address and slash prefix notation (e.g.10.50.0.0/22or172.16.8.0/26) into the online CIDR and subnet extractor. -
Validate Subnet Mask and Host Capacity:
Verify the computed subnet mask (255.255.252.0for/22), wildcard mask (0.0.3.255), total addresses (1,024), and usable host capacity (1,022). -
Identify Network and Broadcast Boundaries:
Review the computed network address (first IP) and broadcast address (last IP) to confirm alignment with your routing plan. -
Extract Full Assignable Host Lists:
Generate the entire sequence of usable IP addresses from start to finish. When auditing legacy network data, you can also extract IP addresses from text logs or parse server access log fields to cross-reference active endpoints against your subnet plan. -
Export Formatted IP Lists for Firewalls:
Copy or download the output formatted as newline-delimited lists, CSV tables, or JSON arrays ready for immediate import into firewall rules and security groups.
Bitwise Arithmetic Behind Subnetting: AND Operations, Host Bits Calculation (2^(32-n) – 2), and Binary Masks
Routers and host network stacks evaluate 32-bit binary strings rather than dotted-decimal numbers. Understanding the underlying bitwise logic is vital for network diagnosis and automation.
1. Bitwise Logical AND Operation
To determine whether a destination IP belongs to the local subnet or default gateway, a network interface applies a bitwise logical AND operation between the destination IP and local subnet mask. An output bit is 1 only when both corresponding input bits are 1:
IP Address (192.168.10.75): 11000000.10101000.00001010.01001011
Subnet Mask (/26): 11111111.11111111.11111111.11000000
------------------------------------------------------------------
Network Address (Bitwise AND): 11000000.10101000.00001010.00000000 -> 192.168.10.0
2. Calculating Total Addresses and Usable Hosts
The number of available host bits in an IPv4 subnet is h = 32 - n, where n is the CIDR prefix length:
- Total Addresses:
N_total = 2^(32 - n) - Usable Hosts (Standard Subnets):
N_usable = 2^(32 - n) - 2
Subtracting 2 accounts for the reserved network address (all host bits 0) and broadcast address (all host bits 1). For a /28 subnet, 32 - 28 = 4 host bits. Total capacity is 2^4 = 16 addresses, and usable hosts equal 16 - 2 = 14 addresses.
3. Subnet Increment (Magic Number)
The “magic number” represents the block size in the interesting octet where the mask splits. Subtracting the mask octet value from 256 yields the block increment. For a 255.255.255.224 (/27) mask in the fourth octet:
Block Size = 256 - 224 = 32
Subnet Ranges:
Subnet 1: 192.168.1.0 to 192.168.1.31 (Broadcast: .31)
Subnet 2: 192.168.1.32 to 192.168.1.63 (Broadcast: .63)
Subnet 3: 192.168.1.64 to 192.168.1.95 (Broadcast: .95)
Subnet 4: 192.168.1.96 to 192.168.1.127 (Broadcast: .127)
CIDR Subnet Cheat Sheet Table (/0 to /32)
The following cheat sheet provides subnet masks, wildcard masks, total capacities, usable hosts, and standard use cases for all IPv4 prefix lengths from /0 to /32:
| Prefix | Subnet Mask | Wildcard Mask | Total Addresses | Usable Hosts | Typical Use Case |
|---|---|---|---|---|---|
| /0 | 0.0.0.0 | 255.255.255.255 | 4,294,967,296 | 4,294,967,294 | Default route (Internet 0.0.0.0/0) |
| /1 | 128.0.0.0 | 127.255.255.255 | 2,147,483,648 | 2,147,483,646 | Global routing table half-split |
| /2 | 192.0.0.0 | 63.255.255.255 | 1,073,741,824 | 1,073,741,822 | IANA top-level regional allocation |
| /3 | 224.0.0.0 | 31.255.255.255 | 536,870,912 | 536,870,910 | Supernet aggregation block |
| /4 | 240.0.0.0 | 15.255.255.255 | 268,435,456 | 268,435,454 | Multicast (Class D) and Future Use (Class E) |
| /5 | 248.0.0.0 | 7.255.255.255 | 134,217,728 | 134,217,726 | Regional Internet Registry (RIR) macro-block |
| /6 | 252.0.0.0 | 3.255.255.255 | 67,108,864 | 67,108,862 | Large RIR allocation block |
| /7 | 254.0.0.0 | 1.255.255.255 | 33,554,432 | 33,554,430 | Tier-1 transit provider block |
| /8 | 255.0.0.0 | 0.255.255.255 | 16,777,216 | 16,777,214 | Legacy Class A / Private RFC 1918 (10.0.0.0/8) |
| /9 | 255.128.0.0 | 0.127.255.255 | 8,388,608 | 8,388,606 | Large enterprise backbone allocation |
| /10 | 255.192.0.0 | 0.63.255.255 | 4,194,304 | 4,194,302 | Carrier-Grade NAT / CGNAT (RFC 6598 100.64.0.0/10) |
| /11 | 255.224.0.0 | 0.31.255.255 | 2,097,152 | 2,097,150 | National ISP aggregation block |
| /12 | 255.240.0.0 | 0.15.255.255 | 1,048,576 | 1,048,574 | Private RFC 1918 block (172.16.0.0/12) |
| /13 | 255.248.0.0 | 0.7.255.255 | 524,288 | 524,286 | Metropolitan ISP distribution network |
| /14 | 255.252.0.0 | 0.3.255.255 | 262,144 | 262,142 | Multi-region enterprise network |
| /15 | 255.254.0.0 | 0.1.255.255 | 131,072 | 131,070 | Large cloud multi-account aggregate |
| /16 | 255.255.0.0 | 0.0.255.255 | 65,536 | 65,534 | Legacy Class B / Standard AWS VPC & Azure VNet root |
| /17 | 255.255.128.0 | 0.0.127.255 | 32,768 | 32,766 | Half-VPC enterprise partition |
| /18 | 255.255.192.0 | 0.0.63.255 | 16,384 | 16,382 | Large cloud availability zone block |
| /19 | 255.255.224.0 | 0.0.31.255 | 8,192 | 8,190 | Cloud region container cluster address pool |
| /20 | 255.255.240.0 | 0.0.15.255 | 4,096 | 4,094 | Availability zone subnet / Campus core VLAN |
| /21 | 255.255.248.0 | 0.0.7.255 | 2,048 | 2,046 | Medium enterprise data centre zone |
| /22 | 255.255.252.0 | 0.0.3.255 | 1,024 | 1,022 | Minimum ISP IPv4 transfer / Kubernetes pod pool |
| /23 | 255.255.254.0 | 0.0.1.255 | 512 | 510 | Multi-tier application deployment block |
| /24 | 255.255.255.0 | 0.0.0.255 | 256 | 254 | Legacy Class C / Standard LAN / Cloud public/private subnet |
| /25 | 255.255.255.128 | 0.0.0.127 | 128 | 126 | Split /24 subnet / Kubernetes worker node group |
| /26 | 255.255.255.192 | 0.0.0.63 | 64 | 62 | Departmental VLAN / Database cluster subnet |
| /27 | 255.255.255.224 | 0.0.0.31 | 32 | 30 | Application tier subnet / Microservice pool |
| /28 | 255.255.255.240 | 0.0.0.15 | 16 | 14 | Small infrastructure subnet / Load balancer tier |
| /29 | 255.255.255.248 | 0.0.0.7 | 8 | 6 | Public WAN gateway / Small office static IP block |
| /30 | 255.255.255.252 | 0.0.0.3 | 4 | 2 | Legacy point-to-point router link |
| /31 | 255.255.255.254 | 0.0.0.1 | 2 | 2 | Modern point-to-point router link (RFC 3021) |
| /32 | 255.255.255.255 | 0.0.0.0 | 1 | 1 | Single host route / Loopback interface / Firewall rule |
Designing Cloud Networks: AWS VPC, Azure VNet, and GCP Subnet Allocation Best Practices
Cloud infrastructure providers (AWS, Microsoft Azure, Google Cloud) manage IP reservation and subnet allocation differently from traditional on-premises routers.
1. Cloud Provider Reserved IP Addresses
While on-premises subnets reserve 2 IP addresses (network and broadcast), major cloud hyperscalers reserve additional internal management IPs within each subnet:
- AWS VPC (5 Reserved IPs per Subnet): In an AWS subnet such as
10.0.1.0/24, AWS reserves:10.0.1.0: Network address.10.0.1.1: Default VPC router.10.0.1.2: AmazonProvidedDNS server.10.0.1.3: Reserved by AWS for future internal use.10.0.1.255: Network broadcast address.
Usable hosts in an AWS /24 subnet equal 251 (256 – 5).
- Azure Virtual Network (5 Reserved IPs per Subnet): Azure reserves 5 IP addresses per subnet: the network address (x.x.x.0), default gateway (x.x.x.1), two Azure DNS mapping IPs (x.x.x.2 and x.x.x.3), and the broadcast address (x.x.x.255).
- Google Cloud Platform (GCP VPC): GCP reserves 4 addresses per subnet: network address (first IP), default gateway (first usable IP), second-to-last IP (future use), and broadcast address (last IP).
2. Cloud Architecture Sizing Guidelines
Follow these best practices when architecting enterprise cloud networks:
- VPC / VNet Root Allocation: Provision a
/16(65,536 IPs, e.g.10.100.0.0/16) or/20(4,096 IPs) root block to permit multi-region expansion. - Availability Zone Partitioning: Divide the VPC block evenly across multiple availability zones (e.g. three
/20subnets for AZ-a, AZ-b, and AZ-c). - Tiered Subnet Slicing: Carve isolated tiers within each AZ for Public Load Balancers (
/26), Application Services/EKS/AKS (/22or/23), and Database Backends (/26or/27). - Prevent CIDR Overlap: Ensure cloud CIDR blocks do not collide with corporate on-premises IP spaces (via DirectConnect or ExpressRoute) or peered VPCs to prevent BGP routing errors.
Special Subnet Cases: Point-to-Point Links (/31 / RFC 3021), Single Host Routes (/32), and Loopback Ranges (127.0.0.0/8)
Specialized prefix allocations depart from standard host calculation formulas:
1. Point-to-Point Links (/31 / RFC 3021)
Traditional point-to-point links required /30 subnets (4 total IPs: 1 network, 1 broadcast, 2 usable interfaces), wasting 50% of the address space. IETF RFC 3021 standardized /31 prefixes (2 total addresses):
Prefix: 192.0.2.0/31
Host 0: 192.0.2.0 (Router Interface A)
Host 1: 192.0.2.1 (Router Interface B)
Subnet Mask: 255.255.255.254
Broadcast: Directed broadcasts are disabled on /31 links.
2. Single Host Routes (/32 Prefix)
A /32 prefix designates a mask of 255.255.255.255 where all 32 bits represent the network portion, leaving zero host bits. Common applications include:
- Router Loopback Interfaces: Stable virtual interfaces used as Router IDs in OSPF and BGP peering.
- Host Routing Entries: Directing traffic to a specific VPN client or tunnel endpoint.
- Firewall Ingress Targets: Restricting SSH or database ports to a single administrative IP address.
3. Loopback & Reserved Address Blocks
RFC 6890 reserves several IPv4 address blocks for specialized purposes:
- Loopback Segment (
127.0.0.0/8): Used exclusively for local host inter-process communication (127.0.0.1). - Link-Local / APIPA (
169.254.0.0/16/ RFC 3927): Configured when DHCP is unavailable. Cloud providers use169.254.169.254/32for instance metadata services. - Documentation Prefixes (TEST-NET / RFC 5737):
192.0.2.0/24,198.51.100.0/24, and203.0.113.0/24reserved for documentation and testing.
Exporting IP Lists for Firewall Allowlists (pfSense, Cisco ACLs, and AWS Security Groups)
Network security administrators frequently transform CIDR blocks into explicit IP ranges or discrete host lists for firewall rule configurations:
1. pfSense and OPNsense Alias Tables
pfSense and OPNsense utilize Firewall Aliases to manage filtering rules. By generating newline-separated IP lists from the online CIDR and subnet extractor, administrators can populate Host Aliases or URL Table Aliases without manual data entry.
2. Cisco IOS Access Control Lists (ACLs)
Cisco hardware routers require wildcard masks rather than standard subnet masks for extended access lists:
! Permitting a /27 subnet (10.20.5.64 to 10.20.5.95)
access-list 101 permit ip 10.20.5.64 0.0.0.31 any
! Permitting a single host (/32)
access-list 101 permit tcp host 198.51.100.14 any eq 443
3. AWS Security Groups and Network ACLs
AWS Security Groups accept CIDR notation directly (e.g. 203.0.113.50/32 for a single admin workstation or 10.0.2.0/24 for an application tier). When creating automated allowlists, generating structured JSON arrays ensures clean CI/CD infrastructure deployment via Terraform or CloudFormation.
When reviewing security logs or troubleshooting access denials, learning how to extract IPs and fields from log files helps verify firewall rules against real-world traffic patterns.
Privacy & Security: Why Proprietary Corporate Network Topologies and VPC Ranges Must Remain 100% Client-Side
Corporate IP addressing schemes, internal subnet layouts, and VPC topologies represent sensitive network architecture data. Disclosing internal IP maps creates severe security risks:
- Internal Reconnaissance Exposure: If an adversary gains access to internal CIDR schemes, they can identify high-value targets (such as database tiers and domain controllers) without running network scans.
- Cloud Server Interception Risks: Submitting corporate network schemes to server-side online calculators sends IP ranges across external HTTP APIs, exposing them to third-party web logs, proxies, and database storage.
- Compliance Violations: Information security standards (including ISO 27001, SOC 2 Type II, and PCI-DSS) require protecting internal network topologies and server inventories from unauthorized external disclosure.
The online CIDR and subnet extractor provides a 100% private, client-side execution model. All bitwise operations, binary masking, and IP list generations execute locally in your web browser’s JavaScript engine. No IP addresses or CIDR parameters are ever transmitted to external servers.
Frequently Asked Questions
What is CIDR notation and how does it work?
CIDR (Classless Inter-Domain Routing) notation represents an IP address and its associated routing prefix length separated by a slash (e.g. 192.168.1.0/24). The number following the slash indicates the number of leading bits dedicated to the network prefix, with the remaining bits allocated for host addresses.
How many usable host IP addresses are in a /24 subnet?
A standard /24 subnet contains 256 total IP addresses and 254 usable host addresses. The first address (.0) is reserved as the network identifier, and the last address (.255) is reserved as the broadcast address.
Why does AWS reserve 5 IP addresses in every VPC subnet?
AWS reserves 5 IP addresses per subnet for internal cloud management: the network address (first IP), the default VPC router (second IP), the Amazon DNS resolver (third IP), an address reserved for future capability (fourth IP), and the network broadcast address (last IP).
What is the difference between a subnet mask and a wildcard mask?
A subnet mask uses binary 1s to identify network bits and binary 0s for host bits (e.g. 255.255.255.0). A wildcard mask is the exact bitwise inverse, using 0s for network bits and 1s for wildcard host bits (e.g. 0.0.0.255), commonly used in Cisco access control lists.
What is an RFC 3021 /31 subnet and where is it used?
An RFC 3021 /31 subnet allocates exactly 2 IP addresses without dedicated network or broadcast addresses. It is used exclusively on point-to-point router links to eliminate the 50% IP address waste inherent in traditional /30 configurations.
How do I calculate the network address from an IP and CIDR prefix?
To calculate the network address, convert both the IP address and the subnet mask to 32-bit binary strings and perform a bitwise logical AND operation between them. The resulting binary string converted back into dotted-decimal notation is the network address.
Is it safe to calculate proprietary corporate subnets using online tools?
It is only safe if the tool operates 100% client-side. EasyExtract calculates all CIDR boundaries and IP address lists directly inside your web browser’s local JavaScript engine, ensuring zero data transmission to external servers.
Related Tools and Reading
Explore related private, browser-based extraction and networking utilities from EasyExtract:
- online CIDR and subnet extractor: Calculate network boundaries, broadcast addresses, and extract complete IP host lists in your browser.
- IP Address Extractor: Isolate and extract IPv4 and IPv6 addresses from unstructured log files and text datasets.
- Log Field Extractor: Parse server access log fields, client IPs, status codes, and request endpoints securely.
- How to Extract IPs and Fields from Log Files: Comprehensive guide to parsing Nginx and Apache access logs for security and SEO audits.
Sources & References
This technical guide references official networking standards, RFC specifications, and cloud documentation:
- IETF RFC 4632: Classless Inter-domain Routing (CIDR): The Internet Address Assignment and Aggregation Plan. Internet Engineering Task Force.
- IETF RFC 1918: Address Allocation for Private Internets (Best Current Practice). Internet Engineering Task Force.
- IETF RFC 3021: Using 31-Bit Prefixes on IPv4 Point-to-Point Links. Internet Engineering Task Force.
- IETF RFC 6890: Special-Purpose IP Address Registries. Internet Engineering Task Force.
- AWS VPC Subnet Sizing Documentation: Amazon Web Services official VPC and Subnet sizing and reserved IP architecture guide.