Short title

Subnet IP Calculator & CIDR Range

Calculate IPv4 subnet masks, CIDR network ranges, usable host addresses, and broadcast IPs. Features bitwise binary inspection, VLSM planning, and cloud VPC rules.

Lbl quick prefixes
Lbl subnet parameters
Badge valid ipv4
Lbl iana prefix RFC 1918 Private (192.168.0.0/16)Lbl class prefix Class C
/24
Lbl reverse solver

Desc reverse solver

150 Unit hosts
Lbl rec prefix:
Lbl rec mask:255.255.255.0
Lbl usable hosts:254 Unit hosts
Lbl slack ips:104 Unit ips
Lbl allocation efficiency:58.6%
Lbl network address
192.168.1.0
Lbl hex prefix 0xC0A80100
Lbl broadcast address
192.168.1.255
Lbl hex prefix 0xC0A801FF
Lbl usable host range
192.168.1.1➔192.168.1.254
Lbl subnet mask255.255.255.0
Lbl wildcard mask0.0.0.255
Lbl total addresses256 Unit ips
Lbl usable hosts254 Unit hosts
Lbl iana scopeRFC 1918 Private (192.168.0.0/16)
Lbl network bits
24 Unit net bits|8 Unit host bits
Lbl active regime Standard RFC 791 IPv4
Desc rfc791 summary
Lbl total addresses256 Unit ips
Lbl usable hosts254 Unit hosts
Lbl wildcard mask0.0.0.255
Lbl iana scopeRFC
Technical Reference & Architecture Guide

Subnet IP Calculator & CIDR Range Guide

Calculate IPv4 subnet masks, CIDR network ranges, usable host addresses, and broadcast IPs. Features bitwise binary inspection, VLSM planning, and cloud VPC rules.

Subnet IP Calculator & CIDR Range Guide — Client-Side In-Memory Architecture & Data Flow
Subnet IP Calculator & CIDR Range Guide — Client-Side In-Memory Architecture & Data Flow

Key Parameters & Controls

Dotted-Decimal IPv4 Address NotationNetwork Layer Protocol Address

Standard 32-bit internet protocol address expressed as four decimal octets separated by periods (e.g. 192.168.1.1). Each octet represents 8 binary bits with a strictly bounded decimal value from 0 to 255 (00000000 to 11111111 binary). Addresses are classified into RFC 1918 Private scopes (10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16) or publicly routable internet unicast spaces.

Default: 192.168.1.1 (Standard Private Class C Gateway)
CIDR Prefix Length (Routing Bitmask /N)Classless Inter-Domain Routing Prefix

A decimal integer from /0 to /32 denoting the exact count of contiguous leading high-order bits (1s) dedicated to identifying the network routing prefix. The remaining (32 - N) bits are allocated for host endpoint addressing within that broadcast domain. A /24 allocates 24 network bits and 8 host bits; a /16 allocates 16 network bits and 16 host bits.

Default: /24 (24 Network Bits, 8 Host Bits)
Subnet Mask (Dotted-Decimal Netmask)Bitwise Boundary Filter Mask

A 32-bit bitmask configured in dotted-decimal format (e.g. 255.255.255.0 for /24, 255.255.240.0 for /20) used by IP routing stacks to separate network bits from host bits. When bitwise ANDed with any IP address (`IP & Netmask`), it zeroes all host bits, extracting the base Network Address to govern Layer 3 packet switching decisions.

Default: 255.255.255.0 (Standard /24 Netmask)
Wildcard Mask (Inverted Cisco ACL Mask)Access Control & OSPF Inverted Bitmask

The exact bitwise complement of the subnet mask, calculated as `255.255.255.255 - Subnet Mask`. In a wildcard mask, binary 0 indicates an exact bit match requirement, while binary 1 represents an ignored 'don't care' bit. Essential for configuring Cisco IOS Access Control Lists (ACLs), OSPF network statements, and BGP route filters.

Default: 0.0.0.255 (Wildcard for 255.255.255.0)
Network & Directed Broadcast Address BoundariesReserved Protocol Delimiter Addresses

Under RFC 791, the absolute first address in any subnet (all host bits set to binary 0) represents the Network Identifier and cannot be assigned to an interface. The absolute last address (all host bits set to binary 1) serves as the Directed Broadcast Address, delivering frames to all subnet hosts simultaneously. Standard usable host capacity is therefore strictly `2^(32 - N) - 2`.

Default: Network: .0 | Broadcast: .255 (for /24 block)
Usable Host IP Range BoundaryAssignable Host Interface Span

The contiguous span of assignable IP addresses between Network Address + 1 (First Usable IP) and Broadcast Address - 1 (Last Usable IP). In standard cloud architectures such as AWS VPC, the first four IP addresses (.0, .1 default gateway, .2 VPC DNS, .3 future spare) and the last IP (.255 broadcast) are permanently reserved by the hypervisor, leaving `2^(32 - N) - 5` usable addresses.

Default: 192.168.1.1 through 192.168.1.254 (254 Usable Hosts)

Pro Tips & Best Practices

The RFC 3021 Point-to-Point Conservation Rule

Never allocate /30 subnets (4 total IPs, only 2 usable) for router-to-router point-to-point links. Standard /30 networks waste 50% of allocated addresses on unused network and broadcast overhead. RFC 3021 defines /31 subnets (2 total IPs, both fully usable as interface endpoints with no broadcast address), halving IP consumption across large enterprise WANs and spine-leaf data center fabrics.

The AWS VPC 5-IP Reservation Cliff

Amazon Web Services permanently reserves the first 4 IP addresses (.0 Network, .1 VPC Router, .2 Amazon Provided DNS, .3 Future AWS Reserve) and the last IP (.255 Directed Broadcast) in every VPC subnet. Consequently, a /28 subnet provides only 11 usable IP addresses rather than the RFC 791 standard of 14, and AWS strictly forbids subnets smaller than /28.

VLSM Descending Allocation Order Rule

When partitioning a contiguous parent CIDR block using Variable Length Subnet Masking (VLSM), always allocate subnets in descending order of host requirements (largest subnet first, smallest subnet last). Allocating smaller subnets before larger subnets causes address space fragmentation, leaving unusable address holes that cannot satisfy power-of-two alignment boundaries.

Bitwise AND Quick Network Calculation Shortcut

To determine the network address without full binary conversion, identify the interesting octet where the subnet mask is neither 255 nor 0. Subtract that mask octet from 256 to find the subnet block increment (e.g. mask 255.255.240.0 has increment 256 - 240 = 16 in octet 3). The network address is the highest multiple of that increment that is less than or equal to the IP octet value.

Common Gotchas & Troubleshooting

⚠️Host Bit Contamination in Network Base Address Specification

Occurs when defining a subnet using an IP address whose host bits are not all zero (e.g. configuring 192.168.1.50/24 as a routing statement instead of 192.168.1.0/24). Cloud providers (AWS/GCP), BGP routers, and iptables reject non-zeroed host bits with 'Invalid CIDR block' errors. Always run bitwise AND (`IP & Mask`) to sanitize the base address before committing routing configurations.

⚠️Overlapping Subnet Range Collision in Multi-VPC Peering

AWS Transit Gateway, Azure VNet Peering, and GCP Interconnect drop peering connections if IP CIDR blocks overlap even by a single host address (e.g. peering 10.0.0.0/16 with 10.0.64.0/18). Audit the complete binary network prefix and use supernetting allocation tables before deploying VPCs to guarantee strictly disjoint address spaces.

⚠️Off-by-One Host Exhaustion on Default Gateway Allocation

Network administrators commonly forget that hypervisor appliances, router VIPs (HSRP/VRRP), and managed Kubernetes control planes consume fixed host addresses. If an application tier requires 14 database nodes, allocating a /28 subnet (14 RFC usable IPs) leaves 0 reserve capacity once the default gateway (.1) is bound. Always budget a minimum 20% host growth buffer.

⚠️Asymmetric Routing and Blackholing from Subnet Mask Mismatch

If Host A is configured with 192.168.1.50/24 (netmask 255.255.255.0) and Host B on the same physical switch is configured with 192.168.1.200/25 (netmask 255.255.255.128), Host A believes Host B is local and sends direct ARP queries, but Host B considers Host A external and routes responses through the gateway. Ensure identical subnet mask distribution across all endpoints in the Layer 2 broadcast domain.

Frequently Asked Questions

How do you calculate a subnet mask and usable IP range from a CIDR prefix?▼

To calculate a subnet mask from a CIDR prefix /N, set the first N bits to 1 and the remaining (32 - N) bits to 0 across four 8-bit octets. For example, /26 has 26 ones (11111111.11111111.11111111.11000000), giving netmask 255.255.255.192. The block size is 2^(32 - 26) = 64 total addresses. Bitwise ANDing an IP like 192.168.1.100 with 255.255.255.192 gives Network Address 192.168.1.64, First Usable IP 192.168.1.65, Last Usable IP 192.168.1.126, and Broadcast Address 192.168.1.127 (62 usable hosts).

What is the difference between a subnet mask and a wildcard mask?▼

A subnet mask uses binary 1s to identify the network portion and binary 0s for the host portion (e.g. 255.255.255.0 is 24 ones followed by 8 zeros), defining the boundary of a single subnet. A wildcard mask is the exact bitwise inversion (calculated as 255.255.255.255 minus the subnet mask, e.g. 0.0.0.255), where binary 0 means 'must match exactly' and binary 1 means 'ignore bit'. Wildcard masks are used in Cisco IOS Access Control Lists (ACLs) and OSPF to match individual subnets or non-contiguous IP ranges.

Why does AWS reserve 5 IP addresses in every VPC subnet?▼

Amazon Web Services permanently reserves 5 IP addresses in every VPC subnet for core infrastructure services: 1) .0 is the Network Address; 2) .1 is the VPC Default Router gateway; 3) .2 is the Amazon Provided DNS (Route 53 Resolver); 4) .3 is reserved by AWS for future routing extensions; and 5) the last IP (e.g. .255 in a /24) is the Network Broadcast. As a result, a /24 VPC subnet provides 251 usable IP addresses rather than 254.

How many usable IP addresses are in a /24, /23, and /22 subnet?▼

Under standard RFC 791 IPv4 networking: a /24 subnet contains 2^(32 - 24) = 256 total IP addresses and 254 usable host addresses; a /23 subnet contains 2^(32 - 23) = 512 total IP addresses and 510 usable host addresses; and a /22 subnet contains 2^(32 - 22) = 1,024 total IP addresses and 1,022 usable host addresses. In cloud environments like AWS, subtract an additional 3 addresses for AWS-reserved infrastructure (.1, .2, .3).

What is RFC 3021 and when can you use a /31 subnet?▼

RFC 3021 is an Internet engineering standard titled 'Using 31-Bit Prefixes on IPv4 Point-to-Point Links'. In traditional subnetting, subnets require at least a /30 prefix (4 IPs) because the first IP is reserved for the network address and the last IP is reserved for broadcast, leaving only 2 usable addresses (50% waste). RFC 3021 permits /31 subnets (only 2 total IPs) for point-to-point links between two routers, treating both addresses as host endpoints with zero broadcast overhead, saving millions of addresses in modern telecom and data center networks.

How do you calculate the network address and broadcast address of an IP?▼

To calculate the network address, perform a bitwise AND operation between the 32-bit binary IP address and the 32-bit subnet mask: `Network = IP & SubnetMask`. This clears all host bits to 0. To calculate the broadcast address, take the network address and perform a bitwise OR operation with the inverted wildcard mask: `Broadcast = Network | (~SubnetMask)`. This sets all host bits to 1. For example, IP 10.1.5.130 with netmask 255.255.255.128 (/25) yields Network Address 10.1.5.128 and Broadcast Address 10.1.5.255.

Related Tools & Utilities

All Tools →