IPv4 Subnet Calculator
Calculate IPv4 networks, subnet masks, wildcard masks, address ranges, and usable hosts. Plan equal-size CIDR subnet splits with a bounded preview and correct /31 and /32 handling.
Tell us more, and we'll get back to you.
Contact UsAbout IPv4 Subnet Calculator
Practical context, assumptions, examples, and next steps for using the result well.Understand IPv4 addresses and CIDR prefixes
An IPv4 address consists of thirty-two bits, usually written as four decimal octets separated by periods. Each octet represents eight bits and ranges from zero through 255. For example, 192.168.1.42 is a complete address, but that address alone does not describe the size of its local network. CIDR notation appends a slash and a prefix length to specify how many leading bits identify the network. In 192.168.1.42/24, the first twenty-four bits are fixed and the remaining eight bits vary within the block.
A longer prefix describes a smaller block because fewer variable bits remain. A /24 has 256 total addresses, a /25 has 128, and a /26 has 64. Each additional prefix bit halves the block. A shorter prefix goes in the opposite direction: a /23 contains twice as many addresses as a /24. The address supplied to this calculator may be any address inside the block. The result normalizes it to the lowest address, which is the canonical network boundary used when writing the network itself.
Modern classless planning uses the supplied prefix rather than guessing a mask from the first octet. Historical class A, B, and C labels do not override an explicit CIDR prefix. Enter an IPv4 address followed by a prefix, or use a contiguous dotted subnet mask after the slash. The calculator displays the network, masks, address counts, usable range, and an equal-size split preview. It performs arithmetic only and does not contact the specified address or make assumptions about who owns the block.
Read subnet masks and wildcard masks
A subnet mask writes the prefix as thirty-two bits: leading ones identify the network portion, and trailing zeros identify the variable address portion. A /24 mask is twenty-four ones followed by eight zeros, which becomes 255.255.255.0 in dotted decimal. A /26 extends two ones into the final octet, producing 255.255.255.192. Within an octet, the possible boundary values follow the binary weights 128, 64, 32, 16, 8, 4, 2, and 1; this is why partial mask octets have a recognizable sequence.
Only contiguous masks correspond to a single CIDR block. A value such as 255.0.255.0 contains zeros between groups of ones, so it cannot be represented by one prefix length. This calculator rejects such masks rather than counting their one bits and pretending they form a network prefix. A dotted mask must also be a strict IPv4-shaped value with four valid decimal octets. Both 0.0.0.0 for /0 and 255.255.255.255 for /32 are valid endpoints of the contiguous mask sequence.
The wildcard mask is the bitwise complement of the subnet mask. Every mask one becomes a wildcard zero, and every mask zero becomes a wildcard one. For /24, the wildcard is 0.0.0.255; for /26, it is 0.0.0.63. Wildcards appear in some access-control and routing configuration syntaxes, but the meaning depends on the device and command. The wildcard displayed here is specifically the inverse of a contiguous subnet mask. Do not assume this calculator interprets arbitrary noncontiguous access-control wildcard expressions or validates vendor configuration language.
Calculate the network, broadcast, and usable range
The number of addresses in a prefix is two raised to the number of remaining bits. For an IPv4 prefix p, the formula is two raised to thirty-two minus p. The network boundary is found by clearing those remaining bits. An equivalent unsigned arithmetic method divides the numeric address by the block size, rounds down to a whole block number, and multiplies by that block size. The final address is the network number plus the block size minus one. This works across octet boundaries as well as within one octet.
For 192.168.1.42/24, the canonical network is 192.168.1.0 and the final address is 192.168.1.255. In a conventional subnet, the lowest address identifies the network and the highest is its directed broadcast address. Removing those two endpoints leaves 254 usable addresses, from 192.168.1.1 through 192.168.1.254. The input address does not determine where the block starts; the prefix determines the alignment. Entering 192.168.1.200/24 would produce the same network and range.
The familiar host-count formula of total addresses minus two applies to conventional prefixes through /30, with important exceptions at /31 and /32. Even where that formula applies, usable means structurally available after the endpoint reservations, not guaranteed assignable in every environment. Cloud providers may reserve extra addresses, a gateway may consume one, and special-purpose IPv4 ranges have additional rules. A displayed broadcast address is also an address-structure result, not a claim that routers will forward directed broadcasts; forwarding policies commonly restrict that behavior.
Handle /31 point-to-point links and /32 host routes correctly
A /31 contains exactly two addresses. Applying the conventional minus-two rule would leave none, but RFC 3021 defines a useful exception for point-to-point links. In that context, both addresses identify endpoints and neither is reserved as a separate directed broadcast. For 192.0.2.10/31, the endpoints are 192.0.2.10 and 192.0.2.11. The calculator shows two usable addresses and marks broadcast as not applicable. The lower address still serves as the canonical start of the CIDR block when the prefix is written.
This treatment is conditional on point-to-point semantics. It should not be read as a universal recommendation for a shared Ethernet segment, every legacy device, or a provider environment that does not support the arrangement. Confirm support and configuration requirements at both ends before deploying a /31. For comparison, a conventional /30 contains four addresses, with two usable endpoints between its network and broadcast addresses. A /31 can therefore conserve address space on suitable links while retaining the two required endpoint addresses.
A /32 is different again: all thirty-two address bits are fixed, leaving one address total. It commonly identifies a host route or a loopback address. Its first and last address are identical, its usable count is one, and it has no separate broadcast address. For 203.0.113.9/32, the entire range is just 203.0.113.9. A host route does not automatically establish a connected multi-host subnet or make the host reachable. Routing, interface configuration, next-hop behavior, and device policy remain separate questions that this arithmetic calculator does not resolve.
Plan equal-size child subnets
Subnet splitting takes one parent block and divides it into aligned children with a longer prefix. If the parent prefix is p and the child prefix is q, the child count is two raised to q minus p. Each child contains two raised to thirty-two minus q addresses. The child prefix must be at least as long as the parent and no longer than thirty-two. Equal prefixes produce one unchanged block. A shorter requested prefix describes a larger network, so it is aggregation rather than a valid split of this parent.
Splitting 192.168.1.0/24 into /26 networks gives four children: 192.168.1.0/26, 192.168.1.64/26, 192.168.1.128/26, and 192.168.1.192/26. Each has 64 total addresses and, under conventional rules, 62 usable addresses. The increment is the entire child block size, not its usable-host count. Reserving network and broadcast addresses happens independently inside each child, so splitting reduces the combined conventional usable count from 254 in the parent to 248 across its four children.
The preview begins at the normalized parent network even if the input contains a host address. You can show the first ten, twenty-five, or fifty children. The total child count is always reported, but the rest are not generated behind the scenes. A /0 split into /32 blocks has more than four billion children; listing them all would be neither useful nor practical. This planner deliberately uses equal-size blocks only. Variable-length subnet masking, where different allocations require different child sizes and an allocation order, is outside the current scope.
Understand large blocks and unsigned IPv4 boundaries
The smallest possible prefix, /0, fixes no bits and spans every IPv4 bit pattern from 0.0.0.0 through 255.255.255.255. Its mask is 0.0.0.0, its wildcard mask is 255.255.255.255, and its total address count is 4,294,967,296. This count is one greater than the largest unsigned thirty-two-bit address value, which is 4,294,967,295. Confusing an address value with an address count creates off-by-one errors at exactly this boundary. The calculator keeps them distinct and reports the full count without signed overflow.
Addresses beginning with octets above 127 are ordinary unsigned IPv4 values, not negative numbers. Some programming-language bitwise operators use signed thirty-two-bit integers and can accidentally turn such addresses into negative results. The engine here uses exact safe-integer arithmetic for IPv4 calculations rather than relying on signed bitwise conversion. All intermediate address values and the complete address count fit comfortably within JavaScript’s safe integer range. This also makes networks ending at 255.255.255.255 behave correctly, including high-address /31 and /32 blocks.
A mathematical /0 host count is not an inventory of public unicast hosts. The block contains private addresses, loopback space, multicast space, reserved patterns, and other special-purpose allocations. Similarly, a computed last address does not imply permission to broadcast to it. The calculator describes aligned blocks and conventional endpoint accounting; it does not subtract every global policy reservation from arbitrary ranges. Use address registries, provider documentation, and your organization’s allocation rules when turning a large address-space calculation into a real routing or deployment plan.
Check a subnet plan before deployment
Start by deciding how many addresses each child really needs, including gateways, infrastructure, management interfaces, expected growth, and platform-specific reservations. For a conventional subnet, choose a power-of-two total address count large enough that subtracting the network and broadcast addresses still meets the requirement. A /27 has 32 total addresses and normally 30 usable ones; it cannot hold thirty-one ordinary host interfaces. The arithmetic is straightforward, but forgetting the reserved endpoints or gateway consumption is a common practical planning mistake.
Next, check alignment and containment. A valid child begins on a multiple of its address count relative to the parent network. In the /24 to /26 example, the final octet advances by 64, and no child extends outside the parent. The total child count multiplied by the addresses per child should equal the parent’s total address count. Children should neither overlap nor leave gaps in a complete equal-size division. The preview gives a quick way to inspect this sequence, while the formulas let you verify the complete plan even when only the first rows are displayed.
Finally, compare the plan with the existing network rather than treating a valid arithmetic result as deployment approval. Confirm that the space is allocated to you, check for overlapping routes or VPN address ranges, and review the intended routing and access-control policies. Use documentation-range addresses when sharing examples publicly. A subnet calculator cannot detect an address already assigned to another device, a hidden provider reservation, or a route that would capture unrelated traffic. Those checks belong in your configuration review and operational tooling.
Strict validation, sharing, and calculation limits
Input validation is intentionally strict. Every address needs four decimal octets; abbreviated addresses, empty octets, signed octets, hexadecimal syntax, scientific notation, and values above 255 are rejected. Leading-zero octets are rejected too, avoiding ambiguity with historical octal parsing conventions. A CIDR prefix must be an ordinary decimal integer from zero through thirty-two, with no decimal point or exponent. A dotted mask must have contiguous leading one bits and trailing zero bits. Outer whitespace around the complete input is ignored, but spaces inside the address or prefix are not accepted.
The split prefix is validated independently. It cannot be shorter than the parent prefix, exceed thirty-two, or contain a loose numeric suffix. When a parent prefix changes, an earlier split choice may become invalid; the calculator explains the problem rather than silently changing the requested plan. Invalid inputs clear the prior results, so an old valid range is not displayed as if it belonged to the new input. The row preview remains bounded even at the most extreme split, and the total count is calculated without enumerating all children.
All calculations run locally and require no live networking or lookup service. Nevertheless, the input values are persisted in the page URL to support sharing and revisiting a calculation. A copied URL can therefore disclose internal addressing details. Avoid sharing sensitive infrastructure information, and review the URL before posting it in a public issue or message. This tool supports IPv4 address structure and equal-size splitting, not IPv6, variable-length allocation, DNS resolution, geolocation, port scans, reachability testing, or automated device configuration. Use it as a precise planning aid within a broader network review.
Frequently Asked Questions
What does /24 mean in an IPv4 address?
A /24 prefix fixes the first twenty-four of an IPv4 address’s thirty-two bits as the network portion. Eight bits remain for addresses within that block, giving 256 total addresses. Under the conventional network-and-broadcast reservation rule, 254 are usable host addresses.
How does the calculator handle /31 point-to-point links?
For a /31, both addresses are treated as usable endpoints according to RFC 3021 point-to-point semantics. There is no separately reserved network or directed-broadcast address for host-count purposes. Confirm that both devices and the actual link type support this arrangement before deployment.
What does a /32 host route contain?
A /32 identifies one IPv4 address, so the first and last address are identical and the usable count is one. There is no distinct broadcast address. A host route identifies a routing destination; it does not by itself allocate an ordinary shared subnet or establish reachability.
Can I enter a dotted subnet mask instead of a prefix?
Yes. Enter an address and slash followed by a contiguous dotted mask, such as 192.168.1.42/255.255.255.0. Noncontiguous masks, octets above 255, leading-zero octets, incomplete addresses, scientific notation, and prefixes outside 0–32 are rejected rather than loosely parsed.
How many /26 subnets fit into a /24?
Four /26 subnets fit into a /24 because two additional network bits create 2 squared combinations. Each child contains 64 total addresses, normally 62 usable hosts. The preview starts at the normalized parent network, not at the input host address.
Does the usable count mean every address can be assigned on the public Internet?
No. Usable counts describe the mathematical subnet structure and its endpoint reservations, not special-purpose address policy, provider reservations, or public reachability. A /0 spans all 4,294,967,296 IPv4 bit patterns, including private, multicast, reserved, and other special ranges.
Does splitting a subnet allocate addresses or check my network?
No. The planner performs equal-size CIDR arithmetic locally and displays only the selected first 10, 25, or 50 children, even when the full plan contains billions of subnets. It neither performs live lookups nor implements variable-length subnet allocation, device discovery, or configuration changes.