IP Subnet Calculator — Calculate CIDR Ranges and Hosts
Calculate CIDR network range, host count, subnet mask, and broadcast addresses for IPv4 and IPv6. Runs entirely in your browser.
IP Subnet Calculator
Calculate network, broadcast, range, and hosts from CIDR notation. Works entirely in your browser.
IP subnetting is the kind of thing network engineers learn once and then mostly forget the details of, because the math is mechanical but the bits in question are not the bits you usually think in. A /24 subnet is the most common block in private networks — 192.168.1.0/24 covers 254 usable host addresses and shows up in every home router, every office WiFi, every Docker bridge network. A /16 covers 65,534 hosts and is the typical size of a corporate allocation. A /30 is a point-to-point link — exactly two usable addresses, used for router-to-router connections and VPN tunnels. Knowing which prefix length gives which count, and what the network and broadcast addresses are for a given block, is the core skill.
The non-obvious thing about subnet math is the difference between IPv4 and IPv6. IPv4 reserves two addresses per subnet (network and broadcast), so a /30 has 4 addresses but 2 usable. IPv6 has no broadcast — the equivalent is multicast — and reserves only the subnet-router anycast address. The usable count in IPv6 is 2^(128-prefix) minus 1, which for any reasonable prefix (/64 or shorter) is so large that the count is meaningless in human terms. The math is the same; the constants differ. The tool handles both with the same parser and labels which fields are IPv4-only.
For a final hand-off: if the goal is firewall or ACL rules, the wildcard mask is the field to copy — Cisco IOS, Juniper Junos, and most network gear accept wildcard masks in their access-list syntax. If the goal is a DHCP pool, the usable host range minus the lowest and highest addresses (gateway and reserved) is the pool to assign. If the goal is a Terraform or Ansible network configuration, the network address and prefix length are the right fields — the CIDR block is what those tools consume.
How to use
Enter an IP and prefix length
Type an IPv4 or IPv6 address with CIDR notation (192.168.1.0/24, 2001:db8::/32) or just an IP and let the tool default to /32. The input validates as you type and flags malformed addresses inline.
Read the network breakdown
The panel shows network address, broadcast (IPv4 only), usable host range, total host count, subnet mask in dotted decimal and hex, and the wildcard mask used in Cisco ACL configuration.
Copy the values
Copy any individual field (network, mask, broadcast) or the whole table as JSON. Useful for pasting into firewall rules, Ansible inventories, Terraform configs, or documentation.
Frequently asked
What does the prefix length mean?
The prefix length (the number after `/`) is the count of leading 1-bits in the subnet mask. /24 means the first 24 bits identify the network, leaving 8 bits for hosts (254 usable addresses in IPv4). /32 means a single host; /0 means the entire IPv4 address space.
Why is the usable host count two less than 2^(32-prefix)?
Two addresses are reserved in every IPv4 subnet: the network address (all host bits zero) identifies the subnet itself, and the broadcast address (all host bits one) is used to send a packet to every host on the subnet. A /30 has 2^(32-30) = 4 addresses but only 2 usable for hosts — exactly enough for a point-to-point link.
Does it support IPv6?
Yes — IPv6 addresses with CIDR notation (2001:db8::/32) are parsed and the network range is computed. IPv6 does not have broadcast addresses; the equivalent concept is multicast, which is configured per-group rather than per-subnet. Total address counts for IPv6 are enormous (2^(128-prefix)) and displayed in scientific notation.
What is the difference between mask and wildcard mask?
The subnet mask is the bitwise AND of an IP with the network mask — it has 1-bits for the network portion and 0-bits for the host portion. The wildcard mask is the bitwise NOT — 0-bits for the network and 1-bits for the host. Wildcard masks are used in Cisco ACL configuration and some routing protocols.
Can I calculate subnets within a larger block?
Yes — toggle 'split into N subnets' to divide the input block into equal-sized subnets. The tool shows the network, broadcast, and host range for each. Useful for planning a /22 carved into four /24s for separate offices or VLANs.
Limitations
- No VLSM planningVariable-Length Subnet Masking (VLSM) planning — picking the smallest subnet that fits a known host count from a larger block — is not exposed as a single operation. The 'split into N' mode gives equal-sized subnets, not optimally-sized ones for known host requirements.
- IPv6 host count is approximateIPv6 address counts above 2^64 are displayed in scientific notation because the full integer would have thousands of digits. The conversion is mathematically exact but not human-readable for /0 and /16 prefixes.
- No DHCP range suggestionThe tool computes the usable host range, but does not suggest a DHCP pool to exclude (typically the lowest and highest addresses are reserved for the gateway and a backup). Post-process the output to reserve those addresses manually.
Platform notes
- macOS
- macOS ships `ipcalc` and `sipcalc` as CLI alternatives for IPv4 only. The browser tool is the right pick for IPv6 calculations and for the broadcast/wildcard breakdown that the CLI tools do not expose.
- Windows
- Windows does not ship a subnet calculator. The closest PowerShell command is `[System.Net.IPAddress]::Parse('192.168.1.5').GetAddressBytes()`. The browser tool is the right pick for the full breakdown including wildcard masks and split calculations.
- Linux
- The `ipcalc` package (Debian, Ubuntu) and `sipcalc` handle IPv4; for IPv6 use `ipcalc-ng` or `subnetcalc`. The browser tool is the right pick for IPv6 wildcard masks and split-into-N subnets that the CLI tools do not cover.
- CLI
- The same library that powers this tool is available as a Python package (netaddr, ipaddress) and Node.js (ip-cidr, netmask). Useful for embedding subnet calculation in scripts, infrastructure-as-code, or network automation pipelines.