{{ results.networkAddress }}
{{ results.broadcastAddress }}
{{ results.firstHost }}
{{ results.lastHost }}
{{ results.totalHosts }}
{{ results.usableHosts }}
{{ results.subnetMask }}
/{{ results.cidr }}
{{ results.wildcardMask }}
{{ results.binaryMask }}
{{ results.networkClass }}
{{ results.networkAddress }} - {{ results.broadcastAddress }}
ℹ️ About Subnet Calculator
Subnet Calculator works out the address boundaries of an IPv4 network from CIDR notation or from an IP address plus a dotted-decimal subnet mask, so you can plan address space before changing routers, firewalls, DHCP scopes, VPNs, or cloud network ACLs. Enter a value such as 192.168.1.42/24 to get the network address 192.168.1.0, broadcast address 192.168.1.255, usable host range, wildcard mask, binary mask, and host capacity. A host address is normalized to its network automatically, so you do not need to zero the host bits yourself. Typical uses: sizing a VLAN or DHCP pool, confirming that two hosts share a subnet by comparing their network addresses, reading off the wildcard mask for a Cisco-style ACL, and checking cloud VPC or BGP prefix plans before deployment.
CIDR routing is defined in
RFC 4632,
while the underlying IPv4 address and datagram format comes from
RFC 791.
Private address blocks such as 10.0.0.0/8, 172.16.0.0/12, and 192.168.0.0/16 follow
RFC 1918,
and the calculator flags a network as private when its network address falls inside one of them.
Supported inputs
- CIDR mode: one IPv4 address with a prefix length, for example
192.168.1.0/24,10.10.0.0/16, or a host address such as192.168.1.100/24. The prefix must be between/0and/32. - IP + Subnet Mask mode: an IPv4 address in one field and a subnet mask picked from a list that runs from
/1(128.0.0.0) to/31(255.255.255.254). The mask is converted to a prefix length by counting its leading one bits. - Addresses must be plain dotted decimal: four octets from 0 to 255 with no leading zeros (
192.168.001.0is rejected). Surrounding whitespace is trimmed; anything else, including a space between the address and a mask, is rejected. - Four presets (
192.168.1.0/24,10.0.0.0/8,172.16.0.0/12,192.168.0.0/16) fill the CIDR field with one click. - The API takes the same fields as JSON:
inputFormat(cidrormask, defaultcidr),cidrInput(aliasinput),ipInput, andsubnetMask. In mask mode the API accepts any dotted-decimal mask string, not only the values in the dropdown.
Output
- Network information: network address, broadcast address, first host (network + 1), last host (broadcast - 1), total addresses (2 to the power of the host bits), and usable hosts (total minus 2, never below 0).
- Subnet mask details: dotted-decimal mask, CIDR prefix, wildcard (inverse) mask, the mask in dotted binary, and the legacy network class (A, B, C, D (Multicast), or E (Reserved)) taken from the first octet of the network address.
- Advanced analysis: host bits, network bits, how many subnets of this size fit in the default classful block, the full address range, and a Private or Public label taken from the network address.
- Host and subnet counts are formatted with thousands separators, for example
16,777,214. Copy buttons sit next to each address, and Copy All places a plain-text summary on the clipboard. - The API returns the same values in a JSON
resultobject withvalid: true.totalHosts,usableHosts, andsubnetsFromClassare formatted strings,cidr,hostBits, andnetworkBitsare integers, andisPrivateis a boolean. Malformed input returns HTTP 400 withsuccess: falseand an error message; a blank address or mask returns HTTP 200 withsuccess: trueandresult.validset to false.
Example
Entering 10.20.30.40/26 in CIDR mode produces:
Network address: 10.20.30.0
Broadcast address: 10.20.30.63
First host: 10.20.30.1
Last host: 10.20.30.62
Total hosts: 64
Usable hosts: 62
Subnet mask: 255.255.255.192 (/26)
Wildcard mask: 0.0.0.63
Binary mask: 11111111.11111111.11111111.11000000
Network class: A Host bits: 6 Network bits: 26
Subnets from /8: 262,144 Private: yes
Posting {"inputFormat":"cidr","cidrInput":"10.20.30.40/26"} to the API returns the same values as JSON.
Limitations
- IPv4 only. IPv6 prefixes such as
2001:db8::/32are rejected as an invalid network format. - Wildcard masks are not recognized as input. The UI has no field for one, and a wildcard mask posted to the API as
subnetMask, such as0.0.0.255, has no leading one bits and is silently read as/0. Enter the matching subnet mask instead; the wildcard mask is shown in the results. - Usable hosts always follows the classic total-minus-2 formula, so a
/31and a/32both report 0 usable hosts and their first and last host fields are not meaningful. RFC 3021 point-to-point links actually use both addresses of a/31, and a/32is a single host route; read those two sizes accordingly. - A non-contiguous mask sent through the API, such as
255.255.0.255, is not rejected: only its leading one bits are counted, so it is treated as/16. - Private detection covers only the three RFC 1918 blocks and only looks at the network address, so a supernet such as
10.0.0.0/7is labeled Private even though half of its range (11.0.0.0/8) is public. Loopback (127.0.0.0/8), link-local (169.254.0.0/16), shared address space (100.64.0.0/10), multicast, and other special-purpose ranges are labeled Public, so check them against the IANA IPv4 Special-Purpose Address Registry before treating an address as publicly routable. - Class A/B/C labels are shown for context only because classful routing has been replaced by CIDR. The subnets-from-class count uses
/8,/16, and/24as the default sizes for classes A, B, and C (and/24for D and E) and shows 1 whenever the prefix is not longer than that default. - One network at a time: the tool does not split a block into child subnets, list every address in a range, or compare two arbitrary addresses. Run each address separately and compare the network addresses, or use the CIDR Calculator and IP Range Calculator linked under related tools.
Browser or server processing
The calculation runs entirely in your browser: the page loads the compiled subnet-calculator logic module and recomputes on every keystroke without contacting the server, so the addresses you type never leave your device. The public API at /api/tools/network/subnet-calculator runs the same module on the server through Node.js for scripts and automation. It performs no DNS lookups or network probes and only processes the JSON body you post.
FAQ
How many usable hosts are in a /24?
254. A /24 leaves 8 host bits, which gives 256 addresses; the lowest is the network address and the highest is the broadcast address, leaving 254 for hosts. A /25 halves that to 126 and a /23 doubles it to 510.
What is the difference between the network address and the broadcast address?
The network address has every host bit set to 0 and identifies the subnet itself in routing tables; the broadcast address has every host bit set to 1 and reaches all hosts on the subnet at once. Neither is assigned to a device, which is why the calculator subtracts two from the total address count.
Does it support IPv6?
No. This calculator handles 32-bit IPv4 addresses with prefixes from /0 to /32 only; an IPv6 prefix is rejected as an invalid network format.
Why does 192.168.1.100/24 show 192.168.1.0 as the network address?
The prefix says the first 24 bits identify the network, so the calculator ANDs the address with the mask 255.255.255.0 and clears the last octet. Every address from 192.168.1.1 to 192.168.1.254 with a /24 belongs to the same 192.168.1.0/24 network.
References
API Usage Example:
POST /api/tools/network/subnet-calculator
Content-Type: application/json
{
"inputFormat": "cidr",
"cidrInput": "192.168.1.0/24"
}