Maths & numbers

IPv4 subnet calculator

Calculate an IPv4 network block mask address range binary representation and explicit host interpretation from a CIDR prefix or dotted mask.

Your numbers

Four decimal octets, each from 0 to 255, without leading zeros.
Examples: /24 or 255.255.255.0. Prefixes /0 through /32 are supported.

Calculated on your device. Your inputs aren’t sent to us.

Your result

Ready when you are

Enter your inputs and select Calculate.

Report an issue

Try it, understand it

Explore the result

Compare prefix size and endpoint conventions without sending a network request.

Worked example comparison
ExampleOutputWhat to notice
Conventional /24 blockNetwork and CIDR prefix192.168.1.0/24256 block addresses produce 254 standard candidate host addresses.
Point-to-point /31Network and CIDR prefix10.0.0.6/31The explicit RFC 3021 interpretation uses both addresses as endpoints.
Single host routeNetwork and CIDR prefix203.0.113.12/32A /32 contains one address and has no subnet-directed broadcast in this interpretation.

Check your understanding

Does capacity imply reachability?

No. A block count does not test routes or host availability.

Is every dotted mask with sixteen one bits /16?

No. The one bits must be contiguous at the start.

Behind the numbers

How this calculation works

Validate the four octets and the contiguous subnet mask, then calculate the network and highest address using exact unsigned bit operations. Distinguish block capacity from conventionally assignable hosts. Standard /0 through /30 ranges exclude network and broadcast; /31 point-to-point mode and a /32 host route have separately stated interpretations.

THE FORMULANetwork = IPv4 address AND mask; block size = 2^(32 − prefix); highest block address = network OR wildcard

A worked example

192.168.1.10 with /24 gives network 192.168.1.0/24, mask 255.255.255.0 and highest address 192.168.1.255. The block contains 256 addresses. Under the standard interpretation, candidate hosts run from 192.168.1.1 through 192.168.1.254, a count of 254.

Good to know

IPv4 subnet arithmetic only, without scanning or configuration changes. Candidate host counts do not establish actual assignability, address availability, routability or reachability. Special-purpose addresses and device reservations remain separate. /31 point-to-point and /32 host-route interpretation must not be applied as ordinary broadcast-LAN rules.

A prefix divides network bits from host bits

An IPv4 address has thirty-two bits, conventionally displayed as four decimal octets. The slash prefix states how many leading bits belong to the network portion. A /24 mask keeps twenty-four bits and leaves eight host bits, so the corresponding block contains 2⁸ = 256 addresses. The dotted mask 255.255.255.0 expresses the same division in octets.

A valid mask consists of one continuous run of one bits followed by zero bits. Merely counting the ones is not enough: 255.0.255.0 has the wrong arrangement even though it contains sixteen one bits. The calculator rejects that mask rather than quietly treating it as /16. It also rejects malformed octets and ambiguous leading-zero notation instead of interpreting a partial number.

Block capacity and candidate host counts answer different questions

The network is obtained by preserving the masked bits and clearing the host bits. Setting all those host bits to one gives the highest address in the block. Under the ordinary broadcast-subnet convention, these two endpoints have network and directed-broadcast roles rather than ordinary host roles. For 192.168.1.10/24, the block runs from .0 through .255, while the conventional candidate host range runs from .1 through .254.

The host count is an arithmetic convention, not an inventory of usable devices. A particular router, cloud platform, DHCP setup or special-purpose address rule can impose additional reservations or restrictions. The calculator does not query a network or determine whether an address has already been assigned. A number appearing in a candidate range does not prove that it is public or reachable from the internet.

Small prefixes need their stated interpretation

A /31 block contains only two addresses. Under the specific RFC 3021 point-to-point interpretation, both can identify endpoints and there is no subnet-directed broadcast. The separate selector makes that interpretation explicit. It does not infer that every two-address segment or broadcast LAN is configured to support that use. A /32 is instead a one-address host route, with the one address reported as its own candidate.

A /0 includes the entire IPv4 address space arithmetically, which is useful for understanding a default prefix but does not make all of that space available for ordinary host assignment. The binary rows expose how the masks and endpoints were calculated. The power calculator can separately inspect a power-of-two block capacity, while the binary converter handles a different representation question. Neither of those arithmetic results tests routing or changes device configuration.

A few questions, answered

Does the tool ping or scan the address?

No. It performs the address and mask arithmetic locally without sending a packet or network request.

Why is a noncontiguous dotted mask rejected?

CIDR masks require leading one bits followed only by zero bits. A mask with one bits after a zero does not define the supported prefix.

Are all candidate addresses available for assignment?

No. Actual use depends on address purpose, routing, device or platform reservations and configuration.

Find your calculator

Start typing to explore the library.