Subnet Calculator
Interactive IPv4 subnet and CIDR mask calculator. Visualize 32-bit network and host binary boundaries, calculate usable IP ranges, broadcast addresses, and subnet masks.
Inspect CIDR prefixes (/0 to /32), network boundaries, broadcast addresses, usable host spans, and cloud VPC reservations.
About Subnet Calculator
Internet Protocol version 4 (IPv4) addressing relies on Classless Inter-Domain Routing (CIDR) subnetting to partition large IP address spaces into manageable, secure network segments. Network engineers, cloud infrastructure architects, DevOps specialists, and systems administrators frequently calculate subnet masks, usable host boundaries, and broadcast addresses when designing virtual private clouds (VPCs), configuring VLANs, and allocating IP blocks.
Performing binary IP address conversions and bitwise masking manually is slow and vulnerable to error. A standard IPv4 address consists of 32 bits arranged in four 8-bit octets. Determining where the network prefix ends and the host identifier begins requires computing bitwise AND and OR operations across the 32-bit sequence. A single misplaced bit can cause IP allocation collisions, broken routing tables, or unreachable subnets.
This Subnet Calculator simplifies IPv4 network planning. By adjusting the interactive CIDR prefix slider from /0 to /32 or typing any valid IPv4 address, the tool instantly outputs the network address, broadcast address, subnet mask, wildcard inverse mask, total available addresses, and usable host range. It also renders an educational 32-bit binary breakdown showing network and host bit distribution, along with cloud architecture notes for AWS, Azure, and Google Cloud VPC reservations.
For complementary network infrastructure audits, analyze domain records with the DNS lookup tool and inspect remote server headers using the HTTP headers checker.
Usage Guide & CLI/Code Examples
- Enter an IPv4 host address in dotted-decimal format (such as 192.168.1.10, 10.0.0.1, or 172.16.0.50).
- Select your CIDR subnet mask using the interactive slider or dropdown menu, ranging from /0 (default route) to /32 (single host).
- Observe the live 32-bit binary bit visualization, which colors network prefix bits in blue and host bits in green.
- Check the calculated network address, broadcast address, and first and last usable host IP addresses.
- Inspect the CIDR summary card to review total IP capacity, usable host count, and cloud VPC reserved addresses.
- Click Copy Subnet Details to transfer formatted network specifications to your clipboard or documentation.
Syntax & Specification Reference
Core Algorithm & Runtime Architecture
Evaluates 32-bit IPv4 integers using unsigned right-shift operations (ip >>> 0) to avoid JavaScript signed 32-bit integer overflow.
Derives network address via bitwise AND (ip & mask) >>> 0 and broadcast address via bitwise OR (ip | ~mask) >>> 0.
Determines total address capacity using formula 2^(32 - CIDR) and standard usable hosts using max(0, 2^(32 - CIDR) - 2) for prefixes up to /30.
Accounts for RFC 3021 /31 point-to-point links (2 usable hosts) and RFC 1122 /32 loopback single-host addressing.
Details AWS VPC 5-address reservation policy (Network, VPC Router, DNS, Future Reserve, Broadcast).
Technical Implementation Notes
- DevOps engineers configuring subnets for AWS Virtual Private Clouds, Azure Virtual Networks, and GCP VPCs.
- Network administrators designing segmented office VLANs and assigning DHCP address pools.
- Students studying for Cisco CCNA, CompTIA Network+, or cloud engineering certifications.
Edge Cases & Compatibility
- For /31 subnets used in point-to-point links under RFC 3021, both IP addresses are usable without a dedicated broadcast address.
- For /32 subnets representing a single host or loopback interface, usable host count equals 1.
Frequently Asked Questions
What is the difference between CIDR notation and a subnet mask?
CIDR notation represents the number of leading 1 bits in the subnet mask, such as /24. The corresponding subnet mask writes this in four dotted-decimal octets, which for /24 is 255.255.255.0.
Why do standard subnets subtract 2 from total IP addresses?
In traditional IPv4 networking, the very first address in any block is reserved as the Network Identifier, and the last address is reserved as the Subnet Broadcast Address. The remaining addresses between them are usable hosts.
Why does AWS reserve 5 IP addresses in every VPC subnet?
Amazon Web Services reserves the first four IP addresses (Network, VPC router, DNS resolver, and future use) plus the final broadcast address in every subnet. Therefore, a /24 subnet on AWS has 251 usable IP addresses instead of 254.
What is a wildcard mask?
A wildcard mask is the bitwise inverse of a subnet mask, calculated by subtracting each octet from 255. For a /24 mask of 255.255.255.0, the wildcard mask is 0.0.0.255, commonly used in Cisco access control lists (ACLs).
Can this tool run offline without an internet connection?
Yes. Once loaded, the calculator runs 100% locally in your browser memory without making any external API calls or network requests.