CIDR Calculator
Calculate subnet details, network range, broadcast addresses, and usable hosts from an IP and prefix.
to 192.168.1.254
Binary Representation (Blue = Network Prefix bits, Gray = Host bits)
Turn an IPv4 address into a subnet plan
The CIDR calculator answers a precise question: given one IPv4 address and a prefix length, which address block contains it? It derives the canonical CIDR block, dotted-decimal subnet mask, wildcard mask, network and broadcast addresses, usable range, address counts, and binary representation. All calculations happen immediately in the browser; no IP address or subnet plan is sent over the network.
CIDR means Classless Inter-Domain Routing. A value such as 192.168.40.73/27 combines an address with a prefix. The /27 says the first 27 of 32 bits identify the network and the remaining five bits identify positions within that block. Prefixes are more useful than the old Class A, B, and C model because they permit blocks sized to actual routing and allocation needs.
Operate the calculator
Type a dotted-decimal IPv4 address into IP Address. Each of the four octets must contain decimal digits from 0 through 255. Then choose /0 through /32 from the mask selector or move the prefix slider. Results update without a submit button.
The input must be an address only. Do not append /24 to the text field; the prefix is a separate control. IPv6, hexadecimal octets, abbreviated forms, hostnames, and values with missing octets are rejected. Whitespace surrounding an individual octet is tolerated, although conventional 192.168.1.10 notation is clearest.
Copy controls are available for the CIDR block, host range, mask, and each details-table value. Clipboard writes are browser features and may require HTTPS and permission. The arithmetic itself remains available if copying is blocked.
Worked example: 192.168.40.73/27
A /27 leaves five host bits, so the block contains 2^5 = 32 addresses. In the final octet, block boundaries occur every 32: 0, 32, 64, 96, and so on. Address 73 falls between 64 and 95. The calculator therefore reports:
CIDR block: 192.168.40.64/27
Subnet mask: 255.255.255.224
Wildcard mask: 0.0.0.31
Network address: 192.168.40.64
First usable: 192.168.40.65
Last usable: 192.168.40.94
Broadcast: 192.168.40.95
Total addresses: 32
Usable hosts: 30
Notice that the entered host address is normalized to 192.168.40.64/27 in the CIDR result. CIDR notation for a block conventionally uses the network address, not an arbitrary member address.
The mask’s final octet, 224, is binary 11100000. Across the whole mask there are 27 one-bits followed by five zero-bits. A bitwise AND between the IP and mask clears host bits and produces the network address. A bitwise OR between that network and the wildcard mask produces the broadcast address.
Reading each field as an operator
Subnet mask is the prefix rendered as four octets. /24 is 255.255.255.0; /16 is 255.255.0.0. CIDR masks are contiguous: one-bits precede zero-bits. The tool does not support discontiguous legacy masks.
Wildcard mask is the bitwise inverse of the subnet mask. Network access-control syntax often uses wildcard masks, where zero means “must match” and one means “may vary.” A wildcard is not interchangeable with a netmask even though both use dotted decimal.
Network address is the first numeric address in the block. Traditional IPv4 subnetting reserves it to identify the subnet. Broadcast address is the last numeric address and traditionally targets all hosts on the subnet. Whether an application or cloud platform exposes these semantics depends on the network environment.
Total Address Count includes every numeric address. For ordinary prefixes through /30, this implementation subtracts two to report Usable Hosts Count, excluding network and broadcast. That is conventional planning arithmetic, but providers can reserve additional addresses for gateways, DNS, platform services, or future use. Never assume the calculated count equals the number of deployable cloud interfaces.
The Binary Representation colors prefix bits separately from host bits. It is especially useful when a boundary does not align with an octet. Compare the IP row and network row: host-bit differences disappear in the network ID, while prefix bits remain identical.
Special cases: /31, /32, and /0
The calculator treats /31 as two usable addresses, with the network number and final address both included in the usable range. This follows the point-to-point interpretation standardized by RFC 3021, where broadcast is unnecessary. Some devices and older configurations may still reject /31, so verify platform support.
For /32, there is exactly one address. The network, broadcast, first usable, and last usable fields all equal that address, and usable hosts is one. A /32 often represents a host route, loopback, firewall object, or single-address rule rather than a conventional LAN.
A /0 contains all 2^32 IPv4 addresses, from 0.0.0.0 to 255.255.255.255. Its mask is 0.0.0.0, and the tool’s traditional subtraction reports 4,294,967,294 usable hosts. In routing, 0.0.0.0/0 commonly denotes the default route, not one practical broadcast domain. Context outranks the raw count.
Subnet sizing without guesswork
For a conventional subnet that needs 50 host addresses, find enough host bits for the requirement plus network and broadcast: six host bits provide 64 total and 62 conventionally usable, yielding /26. For 200 hosts, eight host bits provide 256 total and 254 usable, yielding /24.
Do not size only for today. Allow for high availability, infrastructure interfaces, growth, and provider reservations, while avoiding blocks so large that policy and failure domains become difficult to manage. Aggregation also matters: adjacent aligned blocks can often be summarized, whereas scattered assignments increase routing-table and ACL complexity.
Alignment is mandatory. Two /25 blocks inside 10.20.30.0/24 begin at 10.20.30.0 and 10.20.30.128. A block written 10.20.30.64/25 normalizes to 10.20.30.0/25; it does not create a new 128-address boundary at 64. Use the calculated CIDR block to catch that kind of planning mistake.
Practical use cases
For a firewall change, enter a sample source address and intended prefix. Copy the normalized CIDR and wildcard mask, then compare them with the platform’s syntax. Confirm whether the rule engine expects CIDR, a netmask, or an inverse wildcard; confusing these formats can greatly widen access.
For a cloud VPC design, calculate each proposed subnet and compare network-to-broadcast ranges for overlap. This tool evaluates one block at a time and does not automatically detect overlap, so maintain a separate plan. Provider-reserved addresses and minimum or maximum subnet sizes still apply.
For route troubleshooting, test a destination against the route’s prefix. If both normalize to the same network block, the destination is within that route mathematically. Actual forwarding also depends on longest-prefix match, metrics, policy routing, next-hop reachability, and control-plane state.
For DHCP, use first and last usable only as outer mathematical bounds. Exclude static devices, gateway addresses, reservations, and platform requirements before defining a pool.
Validation and limitations
An invalid field produces Invalid IPv4 format and hides the results. 256.1.1.1, 192.168.1, negative numbers, and alphabetic octets fail validation. The implementation accepts leading zeroes as decimal input; other systems may interpret historical leading-zero forms differently, so remove them when sharing configurations.
This is an IPv4 subnet calculator only. IPv6 uses 128-bit addresses, has no broadcast address, and follows different operational conventions. Do not adapt these “minus two” host rules to IPv6.
The calculator performs mathematical operations, not network discovery. It does not contact the address, verify that a route exists, identify private versus public space, query an IP registry, inspect VLANs, or reserve anything. A valid result can still conflict with another subnet or violate an organization’s address policy.
JavaScript calculates and formats the results locally. No fetch call is present in the component. Inputs disappear with normal page state when the page is unloaded, subject to general browser behavior; the tool does not persist a subnet history.
Common CIDR questions
Why did the CIDR block change the IP I entered?
The entered address may be a host within the subnet. The block is represented by clearing its host bits, which yields the canonical network address.
Is /24 always a Class C network?
No. “Class C” is legacy classful terminology. /24 simply means a 24-bit prefix and can occur anywhere policy and address allocation permit.
Can two CIDR blocks overlap without being equal?
Yes. 10.0.0.0/24 is entirely contained in 10.0.0.0/16. This UI does not compare blocks, so check planned ranges explicitly.
Why does my cloud console show fewer usable addresses?
Cloud providers reserve addresses for platform functions beyond traditional network and broadcast reservations. Consult that provider’s subnet documentation.
Is the wildcard mask used in routing?
It is common in ACL matching and some network configuration syntax. Routes are normally expressed with a prefix or netmask. Always follow the target platform’s field definition.
Does /31 have a broadcast address?
The numeric final address is displayed in the broadcast field because the generic block calculation produces it, but the tool counts both addresses as usable for point-to-point operation. Treat the field according to the actual link and device support.